Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

[node-core-library] SubprocessTerminator ignores SIGHUP, so detached children outlive a closed terminal

未關閉 適合新手
#6,124 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
75/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
node.js, typescript

研究方向

先閱讀 @rushstack/node-core-library 套件中的 SubprocessTerminator,特別是 issue 中提到的 _ensureInitialized 和 _cleanupChildProcesses。檢查現有的 SIGINT/SIGTERM 行為及其測試,接著確認 SIGHUP 在非 Windows 系統上會受到處理並完成清理。完成標準是:關閉終端或收到 SIGHUP 後,重現步驟不再留下仍在執行的已分離子程序。

由索引模型根據 Issue 內容生成。

描述

🤖 Filed by GitHub Copilot acting for @namankanakiya (light review only).

Package: @rushstack/node-core-library 5.25.1. Linux/macOS (non-Windows).

Repro: script.js:

const { SubprocessTerminator } = require('@rushstack/node-core-library');
const c = require('child_process').spawn('sleep', ['1000'], SubprocessTerminator.RECOMMENDED_OPTIONS);
SubprocessTerminator.killProcessTreeOnExit(c, SubprocessTerminator.RECOMMENDED_OPTIONS);
setInterval(() => {}, 1000);

Run it in a terminal, then close the terminal (or kill -HUP <pid>).

Observed: sleep keeps running with ppid 1. RECOMMENDED_OPTIONS (detached: true) puts the child in its own session, so the terminal's hangup never reaches it, and killProcessTreeOnExit only handles SIGINT, SIGTERM and exit. With SIGINT or SIGTERM the child is killed as expected.

Expected: on non-Windows, SIGHUP is handled like SIGINT/SIGTERM, so closing the terminal of a tool that uses SubprocessTerminator does not leak its detached children.

Suggested fix: in _ensureInitialized, also process.prependListener('SIGHUP', _onTerminateSignal), and remove it in _cleanupChildProcesses.

Happy to test a candidate fix.

主要語言
TypeScript
星號
6.5k
分支
710
平均合併
1 天 22 小時
30 天內合併 PR
37

環境準備

在 Codespaces 中開啟

在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 有 Pull Request 範本
  • 沒有貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

microsoft/rushstack 的其他 Issue

查看 microsoft/rushstack 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。