nodejs / nodejs/node

`node --run` should find a way to avoid keeping a shell around and properly forward signals

オープン
#65,712 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

feature request
主要言語
JavaScript
スター
122k
フォーク
37.3k
平均マージ
4日 2時間
マージ済み PR(30日)
283

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

node --run エントリーポイントから始め、package.json スクリプトがどのように起動されるかを追跡し、特に Docker における shell プロセスと PID 1 の挙動に注意してください。issue に記載されたシグナル処理のケースを再現してください。完了条件は、提案された呼び出し方法が不要な shell の残留を避け、既存のスクリプトの挙動を失うことなくシグナルを正しく転送することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
docker, javascript, nodejs, shell
領域
cli, operating-systems
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。