fix(scripts): force taskkill managed trees on windows · openclaw/openclaw@2029f87
vincentkoc
·
2026-06-21
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -136,6 +136,30 @@ describe("managed-child-process", () => {
|
136 | 136 | expect(child.kill).not.toHaveBeenCalled(); |
137 | 137 | }); |
138 | 138 | |
| 139 | +it("force-kills Windows managed process trees when graceful taskkill fails", () => { |
| 140 | +const child = { |
| 141 | +kill: vi.fn(), |
| 142 | +pid: 12345, |
| 143 | +}; |
| 144 | +const runTaskkill = vi |
| 145 | +.fn() |
| 146 | +.mockReturnValueOnce({ error: undefined, status: 1 }) |
| 147 | +.mockReturnValueOnce({ error: undefined, status: 0 }); |
| 148 | + |
| 149 | +terminateManagedChild(child, "SIGTERM", { |
| 150 | +platform: "win32", |
| 151 | + runTaskkill, |
| 152 | +}); |
| 153 | + |
| 154 | +expect(runTaskkill).toHaveBeenNthCalledWith(1, "taskkill", ["/PID", "12345", "/T"], { |
| 155 | +stdio: "ignore", |
| 156 | +}); |
| 157 | +expect(runTaskkill).toHaveBeenNthCalledWith(2, "taskkill", ["/PID", "12345", "/T", "/F"], { |
| 158 | +stdio: "ignore", |
| 159 | +}); |
| 160 | +expect(child.kill).not.toHaveBeenCalled(); |
| 161 | +}); |
| 162 | + |
139 | 163 | it("shares process signal listeners across parallel managed commands", async () => { |
140 | 164 | const signals = ["SIGHUP", "SIGINT", "SIGTERM"] as const; |
141 | 165 | const baseline = new Map(signals.map((signal) => [signal, process.listenerCount(signal)])); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。