Skip to content

Commit

Permalink
Add node 0.6 to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
remy committed Oct 27, 2013
1 parent 84a461f commit 9cb84a8
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ node_js:
- "0.11"
- "0.10"
- "0.8"
- "0.6"
before_script:
- npm install
notifications:
Expand Down
47 changes: 47 additions & 0 deletions lib/exit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
var utils = require('./utils'),
config = require('./config');

// does not export anything, only listens for events
module.exports = {};

// remove the flag file on exit
process.on('exit', function (code) {
if (config.options.verbose) {
utils.log.status('exiting');
}
cleanup();
});

// because windows borks when listening for the SIG* events
if (!utils.isWindows) {
// usual suspect: ctrl+c exit
process.on('SIGINT', function () {
var exitTimeout = null,
exit = function () {
exit = function () {};
cleanup();
process.exit(0);
};

if (child && !isWindows) {
child.removeAllListeners('exit');
child.on('exit', exit);
child.kill('SIGINT');
setTimeout(exit, 10 * 1000); // give up waiting for the kids after 10 seconds
} else {
exit();
}
});

process.on('SIGTERM', function () {
cleanup();
process.exit(0);
});
}

// on exception *inside* nodemon, shutdown wrapped node app
process.on('uncaughtException', function (err) {
util.log('[nodemon] exception in nodemon killing node');
util.error(err.stack);
cleanup();
});

0 comments on commit 9cb84a8

Please sign in to comment.