Skip to content

Instantly share code, notes, and snippets.

@lakowske
lakowske / gist:a3172e1c90dbf0090dcb
Created June 30, 2014 05:56
Testing Process's SIGINT interception
(function(Process) {
describe('Process', function() {
it('intercepts sig int', function(done) {
Process.on('exit', function(exitPromises) {
var exitProcess = new RSVP.Promise(function(resolve, reject) {
setTimeout(function() {
resolve(true);
}, 100);
});
@lakowske
lakowske / gist:8da4636aeac4fbc4e30f
Last active August 29, 2015 14:03
System resources and cooperative process exit
(function(COMPOSITE) {
//Load our dependencies
var util = require('util');
var events = require('events');
var RSVP = require('rsvp');
COMPOSITE.Process = new events.EventEmitter;
//Before we get interrupted, close resources