Skip to content

Commit 0f11c25

Browse files
author
cod1k
committed
Use process.once('beforeExit') instead of process.on('exit').
Replaced the event listener to ensure cleanup runs once before exit instead of during the exit phase. Removed redundant `finally` block handling cleanup to avoid potential conflicts with the updated listener logic. Also, 'beforeExit' event does not fire if process.exit() was called explicitly or in case of other "unexpected" issue, so, we will be able to debug the issue inside temp dir
1 parent e15cb42 commit 0f11c25

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

dev-packages/e2e-tests/run.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async function run(): Promise<void> {
4949
}
5050
}
5151
}
52-
process.on('exit', cleanup);
52+
process.once('beforeExit', cleanup);
5353

5454
// Allow to run a single app only via `yarn test:run <app-name>`
5555
const appName = process.argv[2] || '';
@@ -108,8 +108,6 @@ async function run(): Promise<void> {
108108
} catch (error) {
109109
console.error(error);
110110
process.exit(1);
111-
} finally {
112-
await cleanup();
113111
}
114112
}
115113

0 commit comments

Comments
 (0)