Skip to content

[rush] Using rush-pnpm to run scripts with regex causes bash error #5685

@akres

Description

@akres

Summary

Running a Ubuntu-24.04 in WSL2, with Bash version 5.2.21

As a part of our build setup, I need to invoke pnpm with parallell and a regex as the script specifier.
Since version 5.166 I am unable to do this, because I am presented with an error from bash.

Repro steps

Repro repository: https://github.com/akres/rush-pnpm-regex-repro, main branch.
It is just an empty init'd rush monorepo with one package.

  1. rush install
  2. Go to packages/test and run rushx both
    Expected result:
    Both a and b scripts are executed, resulting in something like
Found configuration in /<redacted>/rush-pnpm-regex-repro/rush.json

Rush Multi-Project Build Tool 5.165.0 - Node.js 22.15.0 (LTS)
> "rush-pnpm run --filter test --parallel \"/a|b/\""

Found configuration in /<redacted>/rush-pnpm-regex-repro/rush.json

. a$ echo 'A'
. b$ echo 'B'
. both$ rush-pnpm run --filter test --parallel "/a|b/"
. a: A
. b: B
. b: Done
. a: Done
. both: Found configuration in /<redacted>/rush-pnpm-regex-repro/rush.json
. both: . a$ echo 'A'
. both: . b$ echo 'B'
. both: . a: A
. both: . b: B
. both: . b: Done
. both: . a: Done
. both: Done

Actual result:

Found configuration in /<redacted>/source/rush-pnpm-regex-repro/rush.json

Rush Multi-Project Build Tool 5.169.3 - Node.js 22.15.0 (LTS)
> "rush-pnpm run --filter test --parallel \"/a|b/\""

Found configuration in /<redacted>/source/rush-pnpm-regex-repro/rush.json

/bin/sh: 1: b/: not found
Error: Failed calling rush-pnpm run --filter test --parallel "/a|b/".  Exit code: 127

Details

The last version where this works is 5.165.0. I have looked at the Changelog of rush and I Have noticed one of the changes in 5.166.0 is

  • Remove use of the deprecated shell: true option in process spawn operations.
    which sounds related. I haven't yet tried to debug this to pinpoint the exact issue.

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/rush globally installed version? 5.169.3
rushVersion from rush.json? 5.169.3
pnpmVersion from rush.json? 10.10.0
(if pnpm) useWorkspaces from pnpm-config.json? true
Operating system? Linux, Ubuntu 24.04 running on WSL 2 Windows 11
Would you consider contributing a PR? Yes
Node.js version (node -v)? 22.15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions