Skip to content

fix(runners): remove duplicated binary in failed command message - #3469

Merged
kamilmysliwiec merged 1 commit into
nestjs:masterfrom
iamkanguk97:fix/runner-duplicated-binary
Jun 16, 2026
Merged

kamilmysliwiec merged 1 commit into
nestjs:masterfrom
iamkanguk97:fix/runner-duplicated-binary

Conversation

@iamkanguk97

Copy link
Copy Markdown
Contributor

PR Checklist

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

When a command executed through AbstractRunner fails, the CLI prints the failed command with the package manager binary duplicated. For example, during nest new with pnpm:

Failed to execute command: pnpm pnpm install --strict-peer-dependencies=false --reporter=silent

In run(), the inner command variable already contains the binary ([this.binary, ...this.args, ...args].join(' ')), but the failure message prepended this.binary once more:

console.error(red(MESSAGES.RUNNER_EXECUTION_ERROR(`${this.binary} ${command}`)));

This produces the duplicated pnpm pnpm.
The bug is package-manager agnostic (npm/yarn would print the same).

Issue Number: nestjs/nest#17135

What is the new behavior?

The failure message now prints the command without duplicating the binary:

Failed to execute command: pnpm install --strict-peer-dependencies=false --reporter=silent

The inner variable is renamed to fullCommand to remove the shadowing of the outer command parameter, and the error message reuses it instead of prepending the binary again. A regression test for AbstractRunner.run() was added.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Verified locally: the new test fails against the previous code and passes with the fix, and the full test suite (npm test) stays green.

@kamilmysliwiec
kamilmysliwiec merged commit c2aefdf into nestjs:master Jun 16, 2026
1 check passed
@kamilmysliwiec

Copy link
Copy Markdown
Member

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants