blob: 45b20b76392dcb6c620e95573e1086c321f7a61c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
let counter = 0;
process.on("beforeExit", () => {
if (process._exiting) {
throw new Error("process._exiting should be undefined");
}
console.log("beforeExit:", counter);
if (!counter++) {
setTimeout(() => {}, 1);
}
});
process.on("exit", () => {
if (!process._exiting) {
throw new Error("process.on('exit') called with process._exiting false");
}
console.log("exit:", counter);
});
|