fix(rpc): force taskkill rtt gateway trees on windows · openclaw/openclaw@ca1aa33
vincentkoc
·
2026-06-21
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -367,6 +367,36 @@ describe("scripts/measure-rpc-rtt.mjs", () => {
|
367 | 367 | expect(child.kill).not.toHaveBeenCalled(); |
368 | 368 | }); |
369 | 369 | |
| 370 | +it("force-kills Windows gateway process trees when graceful taskkill fails", () => { |
| 371 | +const child = Object.assign(new EventEmitter(), { |
| 372 | +exitCode: null, |
| 373 | +kill: vi.fn(), |
| 374 | +pid: 12345, |
| 375 | +signalCode: null, |
| 376 | +}); |
| 377 | +const kill = vi.fn(() => true); |
| 378 | +const runTaskkill = vi |
| 379 | +.fn() |
| 380 | +.mockReturnValueOnce({ error: undefined, status: 1 }) |
| 381 | +.mockReturnValueOnce({ error: undefined, status: 0 }); |
| 382 | + |
| 383 | +expect( |
| 384 | +signalGatewayProcess(child, "SIGTERM", kill, { |
| 385 | +platform: "win32", |
| 386 | + runTaskkill, |
| 387 | +}), |
| 388 | +).toBe(true); |
| 389 | + |
| 390 | +expect(runTaskkill).toHaveBeenNthCalledWith(1, "taskkill", ["/PID", "12345", "/T"], { |
| 391 | +stdio: "ignore", |
| 392 | +}); |
| 393 | +expect(runTaskkill).toHaveBeenNthCalledWith(2, "taskkill", ["/PID", "12345", "/T", "/F"], { |
| 394 | +stdio: "ignore", |
| 395 | +}); |
| 396 | +expect(kill).not.toHaveBeenCalled(); |
| 397 | +expect(child.kill).not.toHaveBeenCalled(); |
| 398 | +}); |
| 399 | + |
370 | 400 | it("treats missing gateway process groups as already exited", () => { |
371 | 401 | const child = Object.assign(new EventEmitter(), { |
372 | 402 | exitCode: null, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。