2015-10-01 00:30:16 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* `Strapi.prototype.stop()`
|
|
|
|
*
|
|
|
|
* The inverse of `start()`, this method
|
|
|
|
* shuts down all attached servers.
|
|
|
|
*
|
|
|
|
* It also unbinds listeners and terminates child processes.
|
|
|
|
*
|
|
|
|
* @api public
|
|
|
|
*/
|
|
|
|
|
|
|
|
module.exports = function stop() {
|
|
|
|
|
2015-12-02 11:18:05 +01:00
|
|
|
// Flag `this._exiting` as soon as the application has begun to shutdown.
|
2015-10-01 00:30:16 +02:00
|
|
|
// This may be used by hooks and other parts of core.
|
2015-12-02 11:18:05 +01:00
|
|
|
this._exiting = true;
|
2015-10-01 00:30:16 +02:00
|
|
|
|
|
|
|
// Exit the REPL.
|
|
|
|
process.exit(0);
|
|
|
|
|
|
|
|
// Emit a `stop` event.
|
2015-12-02 11:18:05 +01:00
|
|
|
this.emit('stop');
|
2015-10-01 00:30:16 +02:00
|
|
|
};
|