Ctrl+C leaves `cf dev` stuck at "Terminate batch job (Y/N)?" on Windows in npm projects
维护者通常 1 天内回复
还没有人认领这个 Issue。
- #413 来自 @Cherry —— 已关闭,未合并
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- node.js, typescript
调研方向
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)?
- 主要语言
- TypeScript
- 星标
- 960
- 派生
- 62
- 平均合并
- 17 小时 15 分钟
- 30 天内合并 PR
- 194
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cloudflare/cf 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
cloudflare/cf#344 ·
维护者通常 1 天内回复
-
upstream
难度 2/5 1-3 小时 新手友好度 72/100
cloudflare/cf#262 ·
维护者通常 1 天内回复
-
`cf dev` rejects `--port` and `--host` for Vite projects, including the `cf init` template可能已有人在做 @jamesopstad 于 17 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
cloudflare/cf#223 · 已指派 2 人 ·
维护者通常 1 天内回复
-
upstream
难度 2/5 1-3 小时 新手友好度 75/100
cloudflare/cf#179 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 72/100
cloudflare/cf#458 ·
维护者通常 1 天内回复
相似的 Issue
-
Replace discontinued crypto-js in the theme可能已有人在做 @aelmanaa 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
PaloAltoNetworks/docusaurus-openapi-docs#1689 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
solana-foundation/solana-web3.js#4015 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
documentation
难度 1/5 1-3 小时 新手友好度 90/100
ivopogace/opencode-courier#422 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
chapel-lang/chapel-vscode#158 ·
维护者通常 1 天内回复