发布

  • fix(core): kill child process tree in different running tasks (#33636)

    frostbyte_neo 发布于 2025-11-27 17:49:19 +00:00

    Current Behavior

    When Nx commands finish or receive termination signals (SIGINT, SIGTERM,
    SIGHUP), child processes spawned by continuous tasks (such as nx serve) can remain orphaned in certain scenarios. This happens because
    only the direct child process is killed using childProcess.kill(),
    leaving grandchild processes running.

    Expected Behavior

    When Nx terminates, all processes in the spawned process tree should be
    properly terminated and no orphaned processes should remain.

    Related Issue(s)

    Fixes #32438
    Fixes #33460

    Changes

    • Updated signal handlers in RunningNodeProcess to use this.kill()
      instead of this.childProcess.kill(), leveraging the existing
      tree-kill implementation
    • Added tree-kill to NodeChildProcessWithNonDirectOutput and
      NodeChildProcessWithDirectOutput kill methods to ensure entire process
      trees are terminated

    (cherry picked from commit 21783402b7)

    下载附件