mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
* Support `process.on('beforeExit')` and `process.on('exit')`
* [bun:sqlite] Always call sqlite3_close on exit
* Update process.test.js
---------
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
19 lines
412 B
JavaScript
19 lines
412 B
JavaScript
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);
|
|
});
|