Execute promises before exiting a process. Useful for cleaning up a process right before it quits.
var fns = require('exit-then');
fns.push(function () {
return new Promise(function (resolve) {
doSomethingAsync(function () {
resolve();
});
});
});