Skip to content

Instantly share code, notes, and snippets.

@hmpmarketing
Created September 25, 2018 11:55
Show Gist options
  • Save hmpmarketing/2c3be3a6a185ab1a4c2c28ff078f848a to your computer and use it in GitHub Desktop.
Save hmpmarketing/2c3be3a6a185ab1a4c2c28ff078f848a to your computer and use it in GitHub Desktop.
function asyncStuff() {
return new Promise((resolve, reject) => {
console.log('call api')
req.post(`${webdomain}/api/p_id/end/${p_id}`)
setTimeout(() => resolve("finished"), 2000);
});
}
function killedHandler() {
console.log("killedHandler called");
asyncStuff().then(console.log('bye') );
// process.exit(1);
}
process.on("SIGINT", killedHandler);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment