diff --git a/.env b/.env index 582460b0d85169..f9a1b8b35e5603 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -NX_ISOLATE_PLUGINS=true \ No newline at end of file +# NX_ISOLATE_PLUGINS=true \ No newline at end of file diff --git a/packages/nx/src/project-graph/plugins/isolation/plugin-pool.ts b/packages/nx/src/project-graph/plugins/isolation/plugin-pool.ts index b38e7a16e294f7..b50a97aed7c3b4 100644 --- a/packages/nx/src/project-graph/plugins/isolation/plugin-pool.ts +++ b/packages/nx/src/project-graph/plugins/isolation/plugin-pool.ts @@ -1,5 +1,6 @@ import { ChildProcess, spawn } from 'child_process'; import path = require('path'); +import { Socket, connect } from 'net'; import { PluginConfiguration } from '../../../config/nx-json'; @@ -9,13 +10,13 @@ import { PluginConfiguration } from '../../../config/nx-json'; import { LoadedNxPlugin, nxPluginCache } from '../internal-api'; import { getPluginOsSocketPath } from '../../../daemon/socket-utils'; import { consumeMessagesFromSocket } from '../../../utils/consume-messages-from-socket'; +import { signalToCode } from '../../../utils/exit-codes'; import { consumeMessage, isPluginWorkerResult, sendMessageOverSocket, } from './messaging'; -import { Socket, connect } from 'net'; const cleanupFunctions = new Set<() => void>(); @@ -247,17 +248,20 @@ function createWorkerExitHandler( } let cleanedUp = false; -const exitHandler = () => { - if (cleanedUp) return; +const exitHandler = (code) => () => { + if (cleanedUp) { + process.exit(code); + } for (const fn of cleanupFunctions) { fn(); } cleanedUp = true; + process.exit(code); }; -process.on('exit', exitHandler); -process.on('SIGINT', exitHandler); -process.on('SIGTERM', exitHandler); +process.on('exit', (code) => exitHandler(code)()); +process.on('SIGINT', exitHandler(signalToCode('SIGINT'))); +process.on('SIGTERM', exitHandler(signalToCode('SIGTERM'))); function registerPendingPromise( tx: string,