Skip to content

fix: progress line shows remnants from external process output (e.g. SSH passphrase prompts) #12350

Description

@Mayank-Maurya

Verify latest release

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

pnpm version

No response

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

No response

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

No response

Reproduction steps

Description

During pnpm install, when SSH passphrase prompts or other external process output writes to the terminal, remnants of that output bleed into the progress line.

Reproduction

Run pnpm install in a project that resolves packages from a git+ssh dependency (or any scenario that triggers an SSH passphrase prompt):

Image

Progress: resolved 36, reused 36, downloaded 0, added 0sa':

The sa': at the end is a leftover fragment from Enter passphrase for key '/Users/.../.ssh/id_rsa': — the progress reporter overwrites the line but doesn't erase characters past the end of the new content.

Describe the Bug

Root cause

The logUpdate function in cli/default-reporter/src/index.ts uses ansi-diff to compute differential terminal updates. ansi-diff writes only the changed characters but does not emit an "erase to end of line" escape (\x1b[K), so when an external process writes a longer line to the terminal between updates, the tail of that longer line remains visible.

Expected Behavior

The progress line should display cleanly without leftover characters from other terminal output.

Which Node.js version are you using?

26

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

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions