nx 21.0.0 → 21.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk=self.webpackChunk||[]).push([[869],{5663:()=>{}},s=>{var e;e=5663,s(s.s=e)}]);
1
+ "use strict";(self.webpackChunk=self.webpackChunk||[]).push([[869],{2259:()=>{}},s=>{var e;e=2259,s(s.s=e)}]);
@@ -231,7 +231,7 @@ class RunningNodeProcess {
231
231
  }
232
232
  kill(signal) {
233
233
  return new Promise((res, rej) => {
234
- if (process.platform === 'win32' || process.platform === 'darwin') {
234
+ if (process.platform === 'win32') {
235
235
  if (this.childProcess.kill(signal)) {
236
236
  res();
237
237
  }
Binary file
@@ -37,5 +37,6 @@ export declare class ForkedProcessTaskRunner {
37
37
  private forkProcessWithPrefixAndNotTTY;
38
38
  private forkProcessDirectOutputCapture;
39
39
  private writeTerminalOutput;
40
+ cleanup(signal?: NodeJS.Signals): void;
40
41
  private setupProcessEventListeners;
41
42
  }
@@ -233,6 +233,12 @@ class ForkedProcessTaskRunner {
233
233
  writeTerminalOutput(outputPath, content) {
234
234
  (0, fs_1.writeFileSync)(outputPath, content);
235
235
  }
236
+ cleanup(signal) {
237
+ this.processes.forEach((p) => {
238
+ p.kill(signal);
239
+ });
240
+ this.cleanUpBatchProcesses();
241
+ }
236
242
  setupProcessEventListeners() {
237
243
  const messageHandler = (message) => {
238
244
  this.pseudoTerminals.forEach((p) => {
@@ -246,29 +252,26 @@ class ForkedProcessTaskRunner {
246
252
  };
247
253
  // When the nx process gets a message, it will be sent into the task's process
248
254
  process.on('message', messageHandler);
249
- const cleanUp = (signal) => {
250
- this.processes.forEach((p) => {
251
- p.kill(signal);
252
- });
253
- process.off('message', messageHandler);
254
- this.cleanUpBatchProcesses();
255
- };
256
255
  // Terminate any task processes on exit
257
256
  process.once('exit', () => {
258
- cleanUp();
257
+ this.cleanup();
258
+ process.off('message', messageHandler);
259
259
  });
260
260
  process.once('SIGINT', () => {
261
- cleanUp('SIGTERM');
261
+ this.cleanup('SIGTERM');
262
+ process.off('message', messageHandler);
262
263
  // we exit here because we don't need to write anything to cache.
263
264
  process.exit((0, exit_codes_1.signalToCode)('SIGINT'));
264
265
  });
265
266
  process.once('SIGTERM', () => {
266
- cleanUp('SIGTERM');
267
+ this.cleanup('SIGTERM');
268
+ process.off('message', messageHandler);
267
269
  // no exit here because we expect child processes to terminate which
268
270
  // will store results to the cache and will terminate this process
269
271
  });
270
272
  process.once('SIGHUP', () => {
271
- cleanUp('SIGTERM');
273
+ this.cleanup('SIGTERM');
274
+ process.off('message', messageHandler);
272
275
  // no exit here because we expect child processes to terminate which
273
276
  // will store results to the cache and will terminate this process
274
277
  });
@@ -645,6 +645,7 @@ class TaskOrchestrator {
645
645
  }
646
646
  // endregion utils
647
647
  async cleanup() {
648
+ this.forkedProcessTaskRunner.cleanup();
648
649
  await Promise.all([
649
650
  ...Array.from(this.runningContinuousTasks).map(async ([taskId, t]) => {
650
651
  try {