Created
January 28, 2021 13:38
-
-
Save HenriqueSilverio/428f7e71e2e4f2332a4b67a8949bff68 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const cleanup = async () => { | |
try { | |
console.log('Cleaning up') | |
} catch (error) { | |
console.error(error) | |
process.exit(1) | |
} | |
} | |
const start = async () => { | |
console.log('Starting') | |
} | |
process.on('uncaughtException', cleanup) | |
process.on('unhandledRejection', cleanup) | |
process.on('SIGTERM', cleanup) | |
process.on('SIGINT', cleanup) | |
start() | |
.catch(cleanup) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment