Skip to content

[rush] Global custom commands: SIGTERM to rush is not forwarded and the shell command keeps running聽#6125

Open

Description

馃 Filed by GitHub Copilot acting for Naman Kanakiya (@namankanakiya) (light review only).

Package: @microsoft/rush-lib 5.178.1 and 5.181.0. Linux.

Repro: in common/config/rush/command-line.json:

{
  "commandKind": "global",
  "name": "loop",
  "summary": "loop",
  "shellCommand": "node -e \"setInterval(() => console.log('alive'), 1000)\""
}

Run rush loop, then from another shell kill -TERM <pid of the rush node process>.

Observed: rush exits, but sh -c node -e ... keeps running with ppid 1 and keeps printing. Ctrl+C works only because the terminal signals the whole foreground process group. A supervisor, IDE task runner or script that stops rush with SIGTERM leaves the custom command running headless (for a long-running dev-server command, that is the whole dev server and its children).

Expected: terminating rush terminates its shell command.

Cause: GlobalScriptAction runs the command via Utilities.executeLifecycleCommand, which uses spawnSync, so no JavaScript signal handler can run while it blocks.

Suggested fix: use executeLifecycleCommandAsync and forward SIGINT/SIGTERM/SIGHUP to the child (or its process group), then exit with the child's code.

Happy to test a candidate fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions