Files
pnpm/exec/commands
Anton Stoychev 179ebc40aa fix(run): make non-recursive --no-bail exit non-zero when a script fails (#12263)
When running a non-recursive `pnpm run --no-bail` that matches multiple scripts (e.g. via a `/regex/` selector), pnpm always exited with code `0` regardless of whether any script failed. This is inconsistent with recursive runs, which aggregate failures and exit non-zero at the end (via `throwOnCommandFail`).

This PR fixes `--no-bail` directly so its exit-code behavior is consistent across recursive and non-recursive runs, as requested in https://github.com/pnpm/pnpm/issues/8013:

- `--no-bail` still runs every matched script to completion (it no longer short-circuits on the first failure — execution switched from `Promise.all` to `Promise.allSettled`).
- After all scripts settle, the command exits with a non-zero exit code (`ERR_PNPM_RUN_FAILED`) if any of them failed.

This is a behavior change: previously a non-recursive `pnpm run --no-bail` with a failing script exited `0`. No new flag is introduced — per the issue discussion, a separate flag "would just add confusion without benefit".

Closes https://github.com/pnpm/pnpm/issues/8013
2026-06-16 12:35:49 +02:00
..
2026-06-15 08:37:08 +02:00
2026-06-15 08:37:08 +02:00

@pnpm/exec.commands

Commands for running scripts

npm version

Installation

pnpm add @pnpm/exec.commands

License

MIT