Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#412 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

  • #413 来自 @Cherry —— 已关闭,未合并

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞

调研方向

The report describes cf dev and cf build launching npm.cmd or npx.cmd through cmd.exe on Windows; no source files or tests are named. Start by tracing how the CLI resolves and launches these commands, then reproduce Ctrl+C in an npm project on Windows. Done means the server stops and cf exits without the batch-job prompt; the linked pull request indicates this work is already under way.

由索引模型根据 Issue 内容生成。

描述

Summary of the issue

On Windows, when cf dev or cf build runs the framework through npm (for example npx astro dev), pressing Ctrl+C stops the dev server but cf doesn't exit. The terminal shows cmd's Terminate batch job (Y/N)? and waits for an answer.

cf resolves npm/npx to the npm.cmd/npx.cmd that ship with Node and runs them through cmd.exe. Unlike the cmd-shim launchers in node_modules\.bin, those two don't end the batch context before starting Node, so cmd asks about the interrupted batch file once npm exits. Running npm run dev directly in PowerShell doesn't hit this because PowerShell uses npm.ps1.

pnpm projects show the same prompt from pnpm's own node_modules\.bin\*.cmd shims, which is outside cf.

Expected behaviour

Ctrl+C stops the dev server and cf exits, the same as on macOS and Linux, and the same as running npm run dev yourself in PowerShell.

Version of cf used

1.0.0-beta.21

System information and package versions

System:
OS: Windows 11 10.0.26300
CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
Memory: 8.60 GB / 31.91 GB
Binaries:
Node: 26.12.0
npm: 11.18.0
pnpm: 12.14.0

Reproduction (optional)

In PowerShell or Windows Terminal, in an npm project cf runs through npx (for example Astro):

cf dev
# wait for the dev server, then press Ctrl+C

The dev server shuts down, then Terminate batch job (Y/N)? appears and cf keeps running until you answer it.

Relevant error logs (optional)
│  Delegating to npx astro dev
...
Terminate batch job (Y/N)?

Fix: https://github.com/cloudflare/cf/pull/413

主要语言
TypeScript
星标
960
派生
62
平均合并
17 小时 15 分钟
30 天内合并 PR
194

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

cloudflare/cf 的其他 Issue

查看 cloudflare/cf 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。