diff --git a/scripts/openclaw-cross-os-release-checks.ts b/scripts/openclaw-cross-os-release-checks.ts index 108adb66ec81..68f9694091e8 100644 --- a/scripts/openclaw-cross-os-release-checks.ts +++ b/scripts/openclaw-cross-os-release-checks.ts @@ -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,