Skip to content

Commit

Permalink
fix: only hook SIGINT on boot - not at require
Browse files Browse the repository at this point in the history
Fixes #1326
  • Loading branch information
remy committed May 5, 2018
1 parent d53a244 commit 9bbc219
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/config/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ function loadFile(options, config, dir, ready) {
config.loaded.push(filename);
}
} catch (e) {
console.error(e);
utils.log.fail('Failed to parse config ' + filename);
console.error(e);
process.exit(1);
}

Expand Down
19 changes: 9 additions & 10 deletions lib/monitor/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,16 +397,15 @@ process.on('exit', function () {

// because windows borks when listening for the SIG* events
if (!utils.isWindows) {
// usual suspect: ctrl+c exit
process.once('SIGINT', function () {
bus.emit('quit');
});

process.once('SIGTERM', function () {
bus.emit('quit');
if (child) { child.kill('SIGTERM'); }
process.exit(0);
});
bus.once('boot', () => {
// usual suspect: ctrl+c exit
process.once('SIGINT', () => bus.emit('quit'));
process.once('SIGTERM', () => {
bus.emit('quit');
if (child) { child.kill('SIGTERM'); }
process.exit(0);
});
})
}


Expand Down
1 change: 1 addition & 0 deletions lib/nodemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var eventHandlers = {};
config.required = utils.isRequired;

function nodemon(settings) {
bus.emit('boot');
nodemon.reset();

// allow the cli string as the argument to nodemon, and allow for
Expand Down

0 comments on commit 9bbc219

Please sign in to comment.