We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c7a2470 commit 28ec0e5Copy full SHA for 28ec0e5
cli.js
@@ -27,3 +27,16 @@ var server = require('./index.js')(argv).listen(argv.port || 4567, function() {
27
var address = server.address(), protocol = argv.ssl ? 'https' : 'http'
28
console.log('Listening at %s://%s:%s', protocol, address.address, address.port)
29
})
30
+
31
+// Handle signals properly
32
+// see: https://github.com/nodejs/node-v0.x-archive/issues/9131
33
+exitOnSignal('SIGINT');
34
+exitOnSignal('SIGTERM');
35
36
+function exitOnSignal(signal) {
37
+ process.on(signal, function() {
38
+ console.log('\ncaught ' + signal + ', exiting');
39
+ // perform all required cleanup
40
+ process.exit(1);
41
+ });
42
+}
0 commit comments