mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
21 lines
446 B
JavaScript
21 lines
446 B
JavaScript
/// A simple interface to register function to be called when the process
|
|
/// exits.
|
|
|
|
var _ = require('underscore');
|
|
|
|
var cleanup = module.exports = {
|
|
_exitHandlers: [],
|
|
|
|
// register a function that will be called on SIGINT (e.g. Cmd-C on
|
|
// mac)
|
|
onExit: function(func) {
|
|
this._exitHandlers.push(func);
|
|
}
|
|
};
|
|
|
|
process.on('SIGINT', function () {
|
|
_.each(cleanup._exitHandlers, function(func) {
|
|
func();
|
|
});
|
|
process.exit();
|
|
}); |