Skip to content

Instantly share code, notes, and snippets.

@ThomasKruegl
Created September 25, 2018 11:38
Show Gist options
  • Save ThomasKruegl/1c41afdf5f4b579d82369fa615a43f4f to your computer and use it in GitHub Desktop.
Save ThomasKruegl/1c41afdf5f4b579d82369fa615a43f4f to your computer and use it in GitHub Desktop.
"use strict";
function asyncStuff() {
return new Promise((resolve, reject) => {
setTimeout(() => resolve("finished"), 2000);
});
}
function killedHandler() {
console.log("killedHandler called");
asyncStuff().then(console.log);
// process.exit(1);
}
process.on("SIGINT", killedHandler);
function foo() {
console.log("foo");
}
const Timer = setInterval(foo, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment