Skip to content

--no-bail behavior inconsistent #8013

Description

@c-vetter

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

9.0.6

Which area(s) of pnpm are affected? (leave empty if unsure)

CLI

Link to the code that reproduces this issue or a replay of the bug

https://github.com/c-vetter/repro_pnpm_inconsistent-nobail

Reproduction steps

In the repro, pnpm lint, then check the exit code.

Describe the Bug

--no-bail is listed on the website for --recursive, but not for plain run.

Based on #3036, --no-bail is currently specced to always exit 0, at least without --recursive. I don't have a monorepo to test right now, but if I read the tests correctly, with --recursive, --no-bail exits with a fixed code, with the symbol "ERR_PNPM_RECURSIVE_FAIL". That would mean that the behavior for pnpm run --recursive --no-bail is consistent with the website docs, while the behavior for pnpm run --no-bail is different.

#7381 is related. I have pretty much exactly the same use-case as @mizdra and am coming from npm-run-all as well. Based on the current behavior, I cannot switch although I would like to drop the dependency. I was thinking about adding this there, but it seemed more appropriate to open a new bug report.

#7381 could be interpreted as advocating a new parameter, in addition to --no-bail. While I don't think that is actually the case, I want to be clear. --no-bail should be fixed, there is no need for another parameter – that would just add confusion without benefit. For those users who don't care about the exit code, it's trivial to ignore it. But when the failure state matters, we cannot easily extract that without parsing the logs, which is just the wrong way to go.

Expected Behavior

When running with --no-bail, exit code should be 0 if all sub-runs exit 0, and non-0 otherwise. Irrespective of whether or not --recursive is active.

Which Node.js version are you using?

20.12.2

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

If your OS is a Linux based, which one it is? (Include the version if relevant)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions