fix(scripts): force taskkill run-with-env trees on windows · openclaw/openclaw@f640ca1
vincentkoc
·
2026-06-21
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -184,6 +184,30 @@ describe("run-with-env", () => {
|
184 | 184 | expect(child.kill).not.toHaveBeenCalled(); |
185 | 185 | }); |
186 | 186 | |
| 187 | +it("force-kills Windows wrapped command trees when graceful taskkill fails", () => { |
| 188 | +const child = { |
| 189 | +kill: vi.fn(), |
| 190 | +pid: 12345, |
| 191 | +}; |
| 192 | +const runTaskkill = vi |
| 193 | +.fn() |
| 194 | +.mockReturnValueOnce({ error: undefined, status: 1 }) |
| 195 | +.mockReturnValueOnce({ error: undefined, status: 0 }); |
| 196 | + |
| 197 | +signalRunWithEnvChild(child, "SIGTERM", { |
| 198 | +platform: "win32", |
| 199 | + runTaskkill, |
| 200 | +}); |
| 201 | + |
| 202 | +expect(runTaskkill).toHaveBeenNthCalledWith(1, "taskkill", ["/PID", "12345", "/T"], { |
| 203 | +stdio: "ignore", |
| 204 | +}); |
| 205 | +expect(runTaskkill).toHaveBeenNthCalledWith(2, "taskkill", ["/PID", "12345", "/T", "/F"], { |
| 206 | +stdio: "ignore", |
| 207 | +}); |
| 208 | +expect(child.kill).not.toHaveBeenCalled(); |
| 209 | +}); |
| 210 | + |
187 | 211 | it.runIf(process.platform !== "win32").each(["SIGTERM", "SIGHUP", "SIGINT"] as const)( |
188 | 212 | "forwards parent %s to the wrapped command", |
189 | 213 | async (signal) => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。