Skip to content

Commit

Permalink
Exit the process with signal
Browse files Browse the repository at this point in the history
  • Loading branch information
nazarhussain committed Oct 4, 2023
1 parent af4c603 commit 652294c
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions scripts/mocha/mocha_run.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,12 @@ async function exitScenarioHandler(failCount) {

process.removeAllListeners("exit");

if (failCount > 0) {
process.exit(0);
} else {
// Observed that process.exit(1) is not exiting the process
// If process still does not exit, we try to kill with signals
for (const signal of ["SIGTERM", "SIGQUIT", "SIGKILL"]) {
process.kill(signal);
}
// This is not working, process still does not exit
// process.exit(failCount > 0 ? 0 : 1);

// If process still does not exit, we try to kill with signals
for (const signal of ["SIGTERM", "SIGQUIT", "SIGKILL"]) {
process.kill(signal);
}
} else {
const activeHandles = process._getActiveHandles().filter((h) => typeof h.fd !== "number" || h.fd > 2); // Filter out stdio handles
Expand Down

0 comments on commit 652294c

Please sign in to comment.