Skip to content

Instantly share code, notes, and snippets.

@fvdm fvdm/exit.js
Last active Sep 14, 2018

What would you like to do?
// Add pre-exit script
process.on ('exit', code => {
console.log (`Whoa! Exit code ${code}, cleaning up...`);
// i.e. close database
// Add another for fun
process.on ('exit', code => {
if (code > 0) {
console.log ('Hmm something went wrong');
} else {
console.log ('And done!');
console.log ('App ready.');
console.log ('Doing app stuff...');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.