Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open Beginner friendly
#6,124 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript

Research direction

Start by reading SubprocessTerminator in the @rushstack/node-core-library package, especially _ensureInitialized and _cleanupChildProcesses, which the issue names. Check the existing SIGINT/SIGTERM behavior and its tests, then verify that SIGHUP is handled and cleaned up on non-Windows. Done when the repro no longer leaves the detached child running after terminal closure or SIGHUP.

Written by the indexing model from the issue text.

Description

🤖 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.

Dominant language
TypeScript
Stars
6.5k
Forks
710
Avg merge
1d 13h
Merged PRs (30d)
45

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/rushstack

All issues in microsoft/rushstack

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.