`node --run` should find a way to avoid keeping a shell around and properly forward signals
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 122k
- 派生
- 37.4k
- 平均合并
- 4 天 3 小时
- 30 天内合并 PR
- 272
描述
What is the problem this feature will solve?
Node has gained node --run as a way to directly execute a package.json script, but this has a glaring subtle limitation currently that has bitten me and likely others, and is also recurring in the existing package managers: It doesn't forward signals properly to the subprocess, and the shell in the middle can even end up swallowing those signals and lingering when invoked node --run is invoked as PID 1 in Docker.
What is the feature you are proposing to solve the problem?
It would be much nicer to have a variant that can function identically to just a direct node script.js invocation, but with the arguments and command line in the package.json for DRY reasons. This can be problematic though, as package.json scripts are currently arbitrary shell scripts, and Node.js likely just uses sh to execute them rather then any JS shell-emulator (Pnpm, Yarn), which can limit it's ability to directly exec the final ran command so the shell in the middle doesn't swallow signals.
What alternatives have you considered?
Don't use node --run or the package mangers, just direct node script.js duplicating the start command.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 node --run 入口点开始,跟踪 package.json 脚本是如何启动的,特别关注 Docker 中的 shell 进程和 PID 1 行为。复现 issue 中描述的信号处理情形;完成标准是,所提出的调用方式能够避免不必要的残留 shell,并正确转发信号,同时不丢失现有脚本行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- docker, javascript, nodejs, shell
- 领域
- cli, operating-systems
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100