@@ -18,6 +18,7 @@ import {
|
18 | 18 | renderRemoteSetup, |
19 | 19 | renderSelectDesktopChat, |
20 | 20 | runCommand, |
| 21 | +signalCommandTree, |
21 | 22 | stageFullSessionArtifacts, |
22 | 23 | startLocalSut, |
23 | 24 | waitForLog, |
@@ -217,7 +218,10 @@ describe("telegram user Crabbox proof log polling", () => {
|
217 | 218 | fs.mkdirSync(publishDir); |
218 | 219 | fs.writeFileSync(path.join(publishDir, "stale.txt"), "stale"); |
219 | 220 | fs.mkdirSync(path.join(outputDir, "publish-gif-only")); |
220 | | -fs.writeFileSync(path.join(outputDir, "session.json"), '{"sshKey":"/private/tmp/openclaw/key"}'); |
| 221 | +fs.writeFileSync( |
| 222 | +path.join(outputDir, "session.json"), |
| 223 | +'{"sshKey":"/private/tmp/openclaw/key"}', |
| 224 | +); |
221 | 225 | fs.writeFileSync(path.join(outputDir, "lease.json"), '{"token":"secret"}'); |
222 | 226 | fs.writeFileSync(path.join(outputDir, "status.json"), '{"ok":true}'); |
223 | 227 | fs.writeFileSync(path.join(outputDir, "probe.json"), '{"ok":true}'); |
@@ -349,6 +353,31 @@ setInterval(() => {}, 1000);
|
349 | 353 | } |
350 | 354 | }); |
351 | 355 | |
| 356 | +it("signals Windows proof command process trees with taskkill", () => { |
| 357 | +const child = { |
| 358 | +kill: vi.fn(), |
| 359 | +pid: 12345, |
| 360 | +}; |
| 361 | +const runTaskkill = vi.fn(() => ({ error: undefined, status: 0 })); |
| 362 | + |
| 363 | +signalCommandTree(child, "SIGTERM", { |
| 364 | +platform: "win32", |
| 365 | + runTaskkill, |
| 366 | +}); |
| 367 | +expect(runTaskkill).toHaveBeenNthCalledWith(1, "taskkill", ["/PID", "12345", "/T"], { |
| 368 | +stdio: "ignore", |
| 369 | +}); |
| 370 | + |
| 371 | +signalCommandTree(child, "SIGKILL", { |
| 372 | +platform: "win32", |
| 373 | + runTaskkill, |
| 374 | +}); |
| 375 | +expect(runTaskkill).toHaveBeenNthCalledWith(2, "taskkill", ["/PID", "12345", "/T", "/F"], { |
| 376 | +stdio: "ignore", |
| 377 | +}); |
| 378 | +expect(child.kill).not.toHaveBeenCalled(); |
| 379 | +}); |
| 380 | + |
352 | 381 | posixIt("lets timed-out command descendants exit during kill grace", async () => { |
353 | 382 | const root = makeTempDir(); |
354 | 383 | const scriptPath = path.join(root, "trap-term-grace.mjs"); |
|