Skip to content

fix: Avoid pnpm batch-shim shutdown hangs on Windows - #14819

Merged
anthonyshew merged 2 commits into
vercel:mainfrom
sahyl:fix/14803-pnpm-cmd-shutdown
Oct 16, 2026
Merged

anthonyshew merged 2 commits into
vercel:mainfrom
sahyl:fix/14803-pnpm-cmd-shutdown

Conversation

@sahyl

@sahyl sahyl commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #14803.

Persistent tasks can hang after Ctrl+C when pnpm is installed through npm on Windows. The app exits, but pnpm.cmd stays alive waiting for batch-job confirmation.

Recognize npm’s native pnpm launcher and run its pnpm.exe directly. Compare the complete shim against the embedded npm-generated fixture before bypassing it so Corepack keeps control of version selection. Existing global-store support remains unchanged.

Add Windows regression tests for npm and Corepack shims, unreadable or modified scripts, paths with spaces, and shim-name casing.

Validation

  • 14 Windows unit tests passed. LF and CRLF coverage now runs through command selection.
  • Native Windows CLI checks confirmed shutdown, argument forwarding, and Corepack version selection.
  • Formatting, Clippy, and diff checks passed.

Unrecognized shim templates keep their existing behavior and may still need a second Ctrl+C. Corepack 0.31.0’s wrapper requires a second Ctrl+C on both main and this branch.

The original checks used Windows GNU builds and generated layout fixtures. Additional verification used Windows 11 ARM64 MSVC on a clean NTFS checkout. It used an actual npm-generated pnpm 12.6.0 shim in a prefix containing spaces, without an adjacent node.exe. One Ctrl+C exited with code 0 and preserved quoted arguments. The directory-fallback test failed as expected when is_file() was temporarily weakened to exists(). A default Node installer setup has not been tested.

@sahyl
sahyl requested review from a team and tknickman October 16, 2026 16:06
@vercel

vercel Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

@sahyl is attempting to deploy a commit to the Internal Apps Team on Vercel.

A member of the Team first needs to authorize it.

@anthonyshew anthonyshew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I did some simplifying and tested that it still works.

@anthonyshew
anthonyshew enabled auto-merge (squash) October 16, 2026 22:49
@anthonyshew
anthonyshew merged commit 9c9236e into vercel:main Oct 16, 2026
78 of 101 checks passed
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.

Windows: persistent task hangs after Ctrl+C when pnpm is installed with npm (pnpm.cmd shim)

2 participants