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

main
cpojer 2026-02-06 09:57:51 +09:00
parent 8abce8a84d
commit f16e32b73d
No known key found for this signature in database
GPG Key ID: C29F94A3201118AF
1 changed files with 11 additions and 9 deletions

View File

@ -34,6 +34,7 @@ async function releaseAllLocks(): Promise<void> {
}
}
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", () => {
@ -43,6 +44,7 @@ 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) {