Skip to content

Commit 9bbc219

Browse files
committed
fix: only hook SIGINT on boot - not at require
Fixes #1326
1 parent d53a244 commit 9bbc219

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

lib/config/load.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ function loadFile(options, config, dir, ready) {
208208
config.loaded.push(filename);
209209
}
210210
} catch (e) {
211-
console.error(e);
212211
utils.log.fail('Failed to parse config ' + filename);
212+
console.error(e);
213213
process.exit(1);
214214
}
215215

lib/monitor/run.js

+9-10
Original file line numberDiff line numberDiff line change
@@ -397,16 +397,15 @@ process.on('exit', function () {
397397

398398
// because windows borks when listening for the SIG* events
399399
if (!utils.isWindows) {
400-
// usual suspect: ctrl+c exit
401-
process.once('SIGINT', function () {
402-
bus.emit('quit');
403-
});
404-
405-
process.once('SIGTERM', function () {
406-
bus.emit('quit');
407-
if (child) { child.kill('SIGTERM'); }
408-
process.exit(0);
409-
});
400+
bus.once('boot', () => {
401+
// usual suspect: ctrl+c exit
402+
process.once('SIGINT', () => bus.emit('quit'));
403+
process.once('SIGTERM', () => {
404+
bus.emit('quit');
405+
if (child) { child.kill('SIGTERM'); }
406+
process.exit(0);
407+
});
408+
})
410409
}
411410

412411

lib/nodemon.js

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ var eventHandlers = {};
1717
config.required = utils.isRequired;
1818

1919
function nodemon(settings) {
20+
bus.emit('boot');
2021
nodemon.reset();
2122

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

0 commit comments

Comments
 (0)