Last active
September 14, 2018 12:29
-
-
Save fvdm/ca2716b40ff4d98acad4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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