fix: Do not process.exit(0) in the middle of a test.
This commit is contained in:
@@ -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);
|
||||||
void releaseAllLocks().then(() => process.exit(0));
|
process.on("SIGTERM", () => {
|
||||||
});
|
void releaseAllLocks().then(() => process.exit(0));
|
||||||
process.on("SIGINT", () => {
|
});
|
||||||
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'
|
});
|
||||||
|
// 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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user