- When this app is started with
node index
, a SIGINT (Ctrl+c) is caught by the app and it continues running. - When this app is started with
npm start
, a SIGINT causes npm to exit, detaching the still running node process from the foreground.
Created
November 7, 2014 22:39
-
-
Save markhuge/fe5572ad1e98f723445b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
console.log(process.pid); | |
http.createServer().listen(9001); | |
process.on('SIGINT', function () { | |
console.log('I totally caught this and won\'t exit'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "example", | |
"scripts": { | |
"start": "node index" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment