@pnpm/exec.commands 1100.3.4 → 1100.3.5

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @pnpm/plugin-commands-script-runners
2
2
 
3
+ ## 1100.3.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed orphaned child processes on Windows when pnpm exits on an error while commands spawned by `pnpm exec` or `pnpm dlx` are still running (for example, when one project's command fails during `pnpm --recursive exec`). The PIDs of these commands are now recorded when they are spawned and their whole process trees are terminated with `taskkill` on an error exit. Previously the cleanup relied on enumerating the system process list, which is so slow on Windows that the enumeration hit its timeout and the cleanup was silently skipped [#12406](https://github.com/pnpm/pnpm/issues/12406).
8
+
9
+ - Updated dependencies:
10
+ - @pnpm/bins.resolver@1100.0.9
11
+ - @pnpm/building.commands@1100.1.11
12
+ - @pnpm/cli.utils@1101.0.14
13
+ - @pnpm/config.reader@1101.12.0
14
+ - @pnpm/config.version-policy@1100.1.7
15
+ - @pnpm/core-loggers@1100.2.2
16
+ - @pnpm/deps.status@1100.1.7
17
+ - @pnpm/engine.runtime.commands@1100.1.11
18
+ - @pnpm/exec.lifecycle@1100.1.3
19
+ - @pnpm/installing.client@1100.2.14
20
+ - @pnpm/installing.commands@1100.10.5
21
+ - @pnpm/pkg-manifest.reader@1100.0.10
22
+ - @pnpm/types@1101.4.0
23
+ - @pnpm/workspace.injected-deps-syncer@1100.0.23
24
+ - @pnpm/workspace.project-manifest-reader@1100.0.15
25
+ - @pnpm/workspace.projects-sorter@1100.0.9
26
+
3
27
  ## 1100.3.4
4
28
 
5
29
  ### Patch Changes
package/lib/dlx.js CHANGED
@@ -16,11 +16,11 @@ import { logger } from '@pnpm/logger';
16
16
  import { readPackageJsonFromDir } from '@pnpm/pkg-manifest.reader';
17
17
  import { parseWantedDependency } from '@pnpm/resolving.parse-wanted-dependency';
18
18
  import { lexCompare } from '@pnpm/util.lex-comparator';
19
- import { safeExeca as execa } from 'execa';
20
19
  import { pick } from 'ramda';
21
20
  import { renderHelp } from 'render-help';
22
21
  import { symlinkDir } from 'symlink-dir';
23
22
  import { makeEnv } from './makeEnv.js';
23
+ import { trackedExeca } from './trackedExeca.js';
24
24
  export const skipPackageManagerCheck = true;
25
25
  export const commandNames = ['dlx'];
26
26
  /**
@@ -217,12 +217,13 @@ export async function handler(opts, [command, ...args], commands) {
217
217
  ? command
218
218
  : await getBinName(cachedDir, opts);
219
219
  try {
220
- await execa(binName, args, {
220
+ const child = trackedExeca(binName, args, {
221
221
  cwd: process.cwd(),
222
222
  env,
223
223
  stdio: 'inherit',
224
224
  shell: opts.shellMode ?? false,
225
225
  });
226
+ await child;
226
227
  }
227
228
  catch (err) {
228
229
  if (util.types.isNativeError(err) && 'exitCode' in err && err.exitCode != null) {
package/lib/exec.js CHANGED
@@ -9,7 +9,6 @@ import { logger } from '@pnpm/logger';
9
9
  import { prependDirsToPath } from '@pnpm/shell.path';
10
10
  import { tryReadProjectManifest } from '@pnpm/workspace.project-manifest-reader';
11
11
  import { sortFilteredProjects } from '@pnpm/workspace.projects-sorter';
12
- import { safeExeca as execa } from 'execa';
13
12
  import pLimit from 'p-limit';
14
13
  import { pick } from 'ramda';
15
14
  import { renderHelp } from 'render-help';
@@ -20,6 +19,7 @@ import { existsInDir } from './existsInDir.js';
20
19
  import { makeEnv } from './makeEnv.js';
21
20
  import { PARALLEL_OPTION_HELP, REPORT_SUMMARY_OPTION_HELP, RESUME_FROM_OPTION_HELP, shorthands as runShorthands, } from './run.js';
22
21
  import { runDepsStatusCheck } from './runDepsStatusCheck.js';
22
+ import { trackedExeca } from './trackedExeca.js';
23
23
  export const shorthands = {
24
24
  parallel: runShorthands.parallel,
25
25
  c: '--shell-mode',
@@ -195,7 +195,7 @@ export async function handler(opts, params) {
195
195
  const [cmd, ...args] = params;
196
196
  if (reporterShowPrefix) {
197
197
  const manifest = await readProjectManifestOnly(prefix);
198
- const child = execa(cmd, args, {
198
+ const child = trackedExeca(cmd, args, {
199
199
  cwd: prefix,
200
200
  env,
201
201
  stdio: 'pipe',
@@ -230,12 +230,13 @@ export async function handler(opts, params) {
230
230
  await child;
231
231
  }
232
232
  else {
233
- await execa(cmd, args, {
233
+ const child = trackedExeca(cmd, args, {
234
234
  cwd: prefix,
235
235
  env,
236
236
  stdio: 'inherit',
237
237
  shell: opts.shellMode ?? false,
238
238
  });
239
+ await child;
239
240
  }
240
241
  result[prefix].status = 'passed';
241
242
  result[prefix].duration = getExecutionDuration(startTime);
@@ -0,0 +1,7 @@
1
+ import { safeExeca } from 'execa';
2
+ /**
3
+ * `safeExeca`, but the spawned subprocess is registered with the child-process
4
+ * tracker so its process tree can be terminated if pnpm exits on an error while
5
+ * the command is still running. See `trackChildProcess`.
6
+ */
7
+ export declare const trackedExeca: typeof safeExeca;
@@ -0,0 +1,13 @@
1
+ import { trackChildProcess } from '@pnpm/exec.lifecycle';
2
+ import { safeExeca } from 'execa';
3
+ /**
4
+ * `safeExeca`, but the spawned subprocess is registered with the child-process
5
+ * tracker so its process tree can be terminated if pnpm exits on an error while
6
+ * the command is still running. See `trackChildProcess`.
7
+ */
8
+ export const trackedExeca = ((...args) => {
9
+ const child = safeExeca(...args);
10
+ trackChildProcess(child);
11
+ return child;
12
+ });
13
+ //# sourceMappingURL=trackedExeca.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/exec.commands",
3
- "version": "1100.3.4",
3
+ "version": "1100.3.5",
4
4
  "description": "Commands for running scripts",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -29,33 +29,33 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@inquirer/prompts": "^8.4.3",
32
- "@pnpm/bins.resolver": "1100.0.8",
33
- "@pnpm/building.commands": "1100.1.10",
32
+ "@pnpm/bins.resolver": "1100.0.9",
33
+ "@pnpm/building.commands": "1100.1.11",
34
34
  "@pnpm/catalogs.resolver": "1100.0.0",
35
35
  "@pnpm/cli.command": "1100.0.1",
36
36
  "@pnpm/cli.common-cli-options-help": "1100.0.2",
37
- "@pnpm/cli.utils": "1101.0.13",
38
- "@pnpm/config.reader": "1101.11.2",
39
- "@pnpm/config.version-policy": "1100.1.6",
40
- "@pnpm/core-loggers": "1100.2.1",
37
+ "@pnpm/cli.utils": "1101.0.14",
38
+ "@pnpm/config.reader": "1101.12.0",
39
+ "@pnpm/config.version-policy": "1100.1.7",
40
+ "@pnpm/core-loggers": "1100.2.2",
41
41
  "@pnpm/crypto.hash": "1100.0.1",
42
- "@pnpm/deps.status": "1100.1.6",
43
- "@pnpm/engine.runtime.commands": "1100.1.10",
42
+ "@pnpm/deps.status": "1100.1.7",
43
+ "@pnpm/engine.runtime.commands": "1100.1.11",
44
44
  "@pnpm/error": "1100.0.1",
45
- "@pnpm/exec.lifecycle": "1100.1.2",
45
+ "@pnpm/exec.lifecycle": "1100.1.3",
46
46
  "@pnpm/exec.pnpm-cli-runner": "1100.0.1",
47
- "@pnpm/installing.client": "1100.2.13",
48
- "@pnpm/installing.commands": "1100.10.4",
47
+ "@pnpm/installing.client": "1100.2.14",
48
+ "@pnpm/installing.commands": "1100.10.5",
49
49
  "@pnpm/log.group": "4.0.1",
50
- "@pnpm/pkg-manifest.reader": "1100.0.9",
50
+ "@pnpm/pkg-manifest.reader": "1100.0.10",
51
51
  "@pnpm/resolving.parse-wanted-dependency": "1100.0.1",
52
52
  "@pnpm/shell.path": "1100.0.1",
53
53
  "@pnpm/store.path": "1100.0.2",
54
- "@pnpm/types": "1101.3.2",
54
+ "@pnpm/types": "1101.4.0",
55
55
  "@pnpm/util.lex-comparator": "^4.0.1",
56
- "@pnpm/workspace.injected-deps-syncer": "1100.0.22",
57
- "@pnpm/workspace.project-manifest-reader": "1100.0.14",
58
- "@pnpm/workspace.projects-sorter": "1100.0.8",
56
+ "@pnpm/workspace.injected-deps-syncer": "1100.0.23",
57
+ "@pnpm/workspace.project-manifest-reader": "1100.0.15",
58
+ "@pnpm/workspace.projects-sorter": "1100.0.9",
59
59
  "@zkochan/rimraf": "^4.0.0",
60
60
  "didyoumean2": "^7.0.4",
61
61
  "execa": "npm:safe-execa@0.3.0",
@@ -72,13 +72,13 @@
72
72
  },
73
73
  "devDependencies": {
74
74
  "@jest/globals": "30.4.1",
75
- "@pnpm/engine.runtime.system-version": "1100.0.3",
76
- "@pnpm/exec.commands": "1100.3.4",
75
+ "@pnpm/engine.runtime.system-version": "1100.0.4",
76
+ "@pnpm/exec.commands": "1100.3.5",
77
77
  "@pnpm/logger": "1100.0.0",
78
- "@pnpm/prepare": "1100.0.18",
78
+ "@pnpm/prepare": "1100.0.19",
79
79
  "@pnpm/test-ipc-server": "1100.0.0",
80
- "@pnpm/testing.command-defaults": "1100.0.8",
81
- "@pnpm/workspace.projects-filter": "1100.0.26",
80
+ "@pnpm/testing.command-defaults": "1100.0.9",
81
+ "@pnpm/workspace.projects-filter": "1100.0.27",
82
82
  "@types/is-windows": "^1.0.2",
83
83
  "@types/ramda": "0.31.1",
84
84
  "@types/which": "^3.0.4",