fix: Do not `process.exit(0)` in the middle of a test.
parent
8abce8a84d
commit
f16e32b73d
|
|
@ -34,15 +34,17 @@ async function releaseAllLocks(): Promise<void> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register cleanup handlers to release locks on unexpected termination
|
if (process.env.NODE_ENV !== "test" && !process.env.VITEST) {
|
||||||
process.on("exit", releaseAllLocks);
|
// Register cleanup handlers to release locks on unexpected termination
|
||||||
process.on("SIGTERM", () => {
|
process.on("exit", releaseAllLocks);
|
||||||
|
process.on("SIGTERM", () => {
|
||||||
void releaseAllLocks().then(() => process.exit(0));
|
void releaseAllLocks().then(() => process.exit(0));
|
||||||
});
|
});
|
||||||
process.on("SIGINT", () => {
|
process.on("SIGINT", () => {
|
||||||
void releaseAllLocks().then(() => process.exit(0));
|
void releaseAllLocks().then(() => process.exit(0));
|
||||||
});
|
});
|
||||||
// Note: unhandledRejection handler will call process.exit() which triggers 'exit'
|
// Note: unhandledRejection handler will call process.exit() which triggers 'exit'
|
||||||
|
}
|
||||||
|
|
||||||
function isAlive(pid: number): boolean {
|
function isAlive(pid: number): boolean {
|
||||||
if (!Number.isFinite(pid) || pid <= 0) {
|
if (!Number.isFinite(pid) || pid <= 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue