fix: Do not process.exit(0) in the middle of a test.

This commit is contained in:
cpojer
2026-02-06 09:57:51 +09:00
parent 8abce8a84d
commit f16e32b73d

View File

@@ -34,15 +34,17 @@ async function releaseAllLocks(): Promise<void> {
}
}
// Register cleanup handlers to release locks on unexpected termination
process.on("exit", releaseAllLocks);
process.on("SIGTERM", () => {
void releaseAllLocks().then(() => process.exit(0));
});
process.on("SIGINT", () => {
void releaseAllLocks().then(() => process.exit(0));
});
// Note: unhandledRejection handler will call process.exit() which triggers 'exit'
if (process.env.NODE_ENV !== "test" && !process.env.VITEST) {
// Register cleanup handlers to release locks on unexpected termination
process.on("exit", releaseAllLocks);
process.on("SIGTERM", () => {
void releaseAllLocks().then(() => process.exit(0));
});
process.on("SIGINT", () => {
void releaseAllLocks().then(() => process.exit(0));
});
// Note: unhandledRejection handler will call process.exit() which triggers 'exit'
}
function isAlive(pid: number): boolean {
if (!Number.isFinite(pid) || pid <= 0) {