process global, including the process.on() method for listening to OS signals.
If you don’t know which signal to listen for, you listen to the
"beforeExit" and "exit" events.
See Docs > API > Utils for more useful utilities.
process global, including the process.on() method for listening to OS signals.
process.on("SIGINT", () => {
console.log("Received SIGINT");
});
"beforeExit" and "exit" events.
process.on("beforeExit", code => {
console.log(`Event loop is empty!`);
});
process.on("exit", code => {
console.log(`Process is exiting with code ${code}`);
});
Was this page helpful?