fix(qa-lab): kill qa cli process groups · openclaw/openclaw@5061a7a
vincentkoc
·
2026-06-18
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | // Qa Lab plugin module implements suite runtime agent process behavior. |
2 | | -import { spawn } from "node:child_process"; |
| 2 | +import { spawn, type ChildProcessWithoutNullStreams } from "node:child_process"; |
3 | 3 | import { randomUUID } from "node:crypto"; |
4 | 4 | import path from "node:path"; |
5 | 5 | import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime"; |
@@ -81,6 +81,21 @@ function parseQaCliJsonOutput(text: string) {
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
| 84 | +function signalQaCliProcessTree( |
| 85 | +child: Pick<ChildProcessWithoutNullStreams, "kill" | "pid">, |
| 86 | +signal: NodeJS.Signals, |
| 87 | +) { |
| 88 | +if (process.platform !== "win32" && typeof child.pid === "number") { |
| 89 | +try { |
| 90 | +process.kill(-child.pid, signal); |
| 91 | +return; |
| 92 | +} catch { |
| 93 | +// The detached process group may already be gone; fall back to the child handle. |
| 94 | +} |
| 95 | +} |
| 96 | +child.kill(signal); |
| 97 | +} |
| 98 | + |
84 | 99 | async function runQaCli( |
85 | 100 | env: Pick< |
86 | 101 | QaSuiteRuntimeEnv, |
@@ -100,11 +115,12 @@ async function runQaCli(
|
100 | 115 | ...env.gateway.runtimeEnv, |
101 | 116 | ...opts?.env, |
102 | 117 | }, |
| 118 | +detached: process.platform !== "win32", |
103 | 119 | stdio: ["ignore", "pipe", "pipe"], |
104 | 120 | }); |
105 | 121 | const timeoutMs = resolveTimerTimeoutMs(opts?.timeoutMs, 60_000); |
106 | 122 | const timeout = setTimeout(() => { |
107 | | -child.kill("SIGKILL"); |
| 123 | +signalQaCliProcessTree(child, "SIGKILL"); |
108 | 124 | reject( |
109 | 125 | new QaSuiteInfraError("qa_cli_timeout", `qa cli timed out: openclaw ${args.join(" ")}`), |
110 | 126 | ); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。