Skip to content

fix: exit cleanly on Ctrl+C when npm runs the framework on Windows - #413

Closed
Cherry wants to merge 1 commit into
cloudflare:mainfrom
Cherry:fix/windows-npm-ctrl-c-prompt
Closed

Cherry wants to merge 1 commit into
cloudflare:mainfrom
Cherry:fix/windows-npm-ctrl-c-prompt

Conversation

@Cherry

@Cherry Cherry commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #412

On Windows, cf dev, cf build and cf init run npm/npx through the npm.cmd/npx.cmd bundled with Node. Those keep a batch file running under npm, so after Ctrl+C cmd sits at Terminate batch job (Y/N)? and cf never exits.

runProjectCommand now resolves npm/npx to the CLI script the launcher would run and starts it with Node directly. It follows the launcher's own lookup: the node.exe next to it, and an npm upgraded into the global prefix via npm-prefix.js. Anything it doesn't recognise runs as before.

pnpm projects still prompt from pnpm's own node_modules\.bin shims, which is outside cf.

  • Added npx cases to the Windows console Ctrl+C test, using a verbatim copy of npm's npx.cmd. They hang without this change.
  • Added unit tests for the resolver
  • Added a patch changeset

Node's bundled npm.cmd and npx.cmd keep a batch file running under npm,
so Ctrl+C left cf waiting at cmd's "Terminate batch job (Y/N)?" prompt.
Run npm's CLI script with Node directly instead.

Fixes cloudflare#412
@github-actions

Copy link
Copy Markdown
Contributor

Hi @Cherry. Thanks for contributing to cf!

During the open beta, we’re being very intentional about the changes we accept so that we can prioritise stability for GA. We’re limiting pull requests to contributions coordinated with the team in advance, so this PR has been automatically closed.

We’d still love to hear about your use case, so please make sure it’s captured in a cf issue. If the proposed change fits our priorities, we’d be happy to take another look at this PR.

@github-actions github-actions Bot closed this Oct 25, 2026
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.

Ctrl+C leaves cf dev stuck at "Terminate batch job (Y/N)?" on Windows in npm projects

1 participant