node-cleanup
node-cleanup copied to clipboard
Doesn't seem to work when output is piped
If I run my script (on Ubuntu) as node script.js 2>&1 | tee script.log and press ^C, nothing is printed or logged to the file. Without the piping, I do see the croak being logged.
const nodeCleanup = require('node-cleanup');
setTimeout(function () {}, 10000);
nodeCleanup(function (exitCode, signal) {
// release resources here before node exits
console.log('croak');
});
I'm a Windows user so I'm only guessing here, but won't ctrl+c interrupt the entire pipeline, not just the current step?