mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 00:00:20 +00:00
Replace killProcessTree references to shell-utils with process/kill-tree (#55213)
* Replace killProcessTree references to shell-utils with process/kill-tree * Address grace timeout comment * Align with existing process kill behavior * bash: fail stop without pid * bash: lazy-load kill tree on stop --------- Co-authored-by: Jacob Tomlinson <jtomlinson@nvidia.com>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { spawn } from "node:child_process";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
@@ -166,27 +165,3 @@ export function sanitizeBinaryOutput(text: string): string {
|
||||
}
|
||||
return chunks.join("");
|
||||
}
|
||||
|
||||
export function killProcessTree(pid: number): void {
|
||||
if (process.platform === "win32") {
|
||||
try {
|
||||
spawn("taskkill", ["/F", "/T", "/PID", String(pid)], {
|
||||
stdio: "ignore",
|
||||
detached: true,
|
||||
});
|
||||
} catch {
|
||||
// ignore errors if taskkill fails
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
process.kill(-pid, "SIGKILL");
|
||||
} catch {
|
||||
try {
|
||||
process.kill(pid, "SIGKILL");
|
||||
} catch {
|
||||
// process already dead
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user