fix(release): terminate command descendants on signal

This commit is contained in:
Vincent Koc
2026-06-21 02:03:19 +08:00
parent 89e73240a1
commit 51d1789cea

View File

@@ -4034,13 +4034,14 @@ async function runCommandInvocation(invocation, options) {
child.on("close", (exitCode) => {
if (forwardedSignalExitCode !== undefined) {
// The leader can exit on SIGTERM while descendants remain in its group.
// Kill the group before unregistering so signal forwarding cannot leave them running.
activeChildTree.killChildTree("SIGKILL");
}
activeChildTree.unregister();
if (forwardedSignalExitCode !== undefined) {
activeChildTree.unregister();
finalize(exitForwardedSignalWhenChildTreesDone);
return;
}
activeChildTree.unregister();
finalize(() => {
const result = {
exitCode: exitCode ?? 1,