diff --git a/packages/nx/src/executors/run-commands/running-tasks.ts b/packages/nx/src/executors/run-commands/running-tasks.ts index 4333236e5b6d5..8d5a7a7b4d9aa 100644 --- a/packages/nx/src/executors/run-commands/running-tasks.ts +++ b/packages/nx/src/executors/run-commands/running-tasks.ts @@ -520,7 +520,7 @@ class RunningNodeProcess implements RunningTask { process.on('SIGINT', () => { this.childProcess.kill('SIGTERM'); // we exit here because we don't need to write anything to cache. - process.exit(signalToCode('SIGINT')); + process.exitCode = signalToCode('SIGINT'); }); process.on('SIGTERM', () => { this.childProcess.kill('SIGTERM'); @@ -702,7 +702,7 @@ function registerProcessListener( process.on('SIGINT', () => { runningTask.kill('SIGTERM'); // we exit here because we don't need to write anything to cache. - process.exit(signalToCode('SIGINT')); + process.exitCode = signalToCode('SIGINT'); }); process.on('SIGTERM', () => { runningTask.kill('SIGTERM'); diff --git a/packages/nx/src/tasks-runner/forked-process-task-runner.ts b/packages/nx/src/tasks-runner/forked-process-task-runner.ts index 0cf46c5c88637..e2cb6afbdf61b 100644 --- a/packages/nx/src/tasks-runner/forked-process-task-runner.ts +++ b/packages/nx/src/tasks-runner/forked-process-task-runner.ts @@ -441,7 +441,7 @@ export class ForkedProcessTaskRunner { this.cleanup('SIGTERM'); process.off('message', messageHandler); // we exit here because we don't need to write anything to cache. - process.exit(signalToCode('SIGINT')); + process.exitCode = signalToCode('SIGINT'); }); process.once('SIGTERM', () => { this.cleanup('SIGTERM'); diff --git a/packages/nx/src/tasks-runner/task-orchestrator.ts b/packages/nx/src/tasks-runner/task-orchestrator.ts index 1fc41529895e9..7d60d25a88959 100644 --- a/packages/nx/src/tasks-runner/task-orchestrator.ts +++ b/packages/nx/src/tasks-runner/task-orchestrator.ts @@ -750,7 +750,7 @@ export class TaskOrchestrator { runningTask.onExit((code) => { if (!this.tuiEnabled) { if (code > 128) { - process.exit(code); + process.exitCode = code; } } res(); @@ -816,7 +816,7 @@ export class TaskOrchestrator { childProcess.onExit((code) => { if (!this.tuiEnabled) { if (code > 128) { - process.exit(code); + process.exitCode = code; } } res();