Files
meteor/engine/cleanup.js
Avital Oliver 2787c6dad0 Directory reorg:
- Move lib/ to engine/
- Move server/ into engine/server/
- Remove dead code
2013-03-19 15:11:13 -07:00

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();
});