Last active
November 18, 2020 07:46
-
-
Save danopia/f870f76a9750c994e91faff90812d28a to your computer and use it in GitHub Desktop.
deno cleanup signal test
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
const signals = [ | |
Deno.signal(Deno.Signal.SIGINT), | |
Deno.signal(Deno.Signal.SIGTERM), | |
]; | |
const cleaningUp = Promise.race(signals).then(() => { | |
signals.forEach(x => x.dispose()); | |
}); | |
console.log('Module running...'); | |
cleaningUp.then(() => console.log('do cleanup here')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment