mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 04:47:03 -06:00
fix(security): kill timed out exec process trees
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import type { ChildProcess } from "node:child_process";
|
||||
import { signalProcessTree } from "./kill-tree.js";
|
||||
|
||||
export function shouldDetachChildForProcessTree(): boolean {
|
||||
return process.platform !== "win32";
|
||||
}
|
||||
|
||||
export function forceKillChildProcessTree(child: Pick<ChildProcess, "kill" | "pid">): void {
|
||||
if (typeof child.pid === "number" && child.pid > 0) {
|
||||
signalProcessTree(child.pid, "SIGKILL", {
|
||||
detached: shouldDetachChildForProcessTree(),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
child.kill("SIGKILL");
|
||||
}
|
||||
Reference in New Issue
Block a user