fix(e2e): hard kill timed out host commands · openclaw/openclaw@dd44a47
vincentkoc
·
2026-05-27
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -121,6 +121,7 @@ export function run(command: string, args: string[], options: RunOptions = {}):
|
121 | 121 | encoding: "utf8", |
122 | 122 | env: invocation.env ?? env, |
123 | 123 | input: options.input, |
| 124 | +killSignal: "SIGKILL", |
124 | 125 | maxBuffer: 50 * 1024 * 1024, |
125 | 126 | stdio: options.quiet ? ["pipe", "pipe", "pipe"] : ["pipe", "pipe", "pipe"], |
126 | 127 | shell: invocation.shell, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -608,6 +608,29 @@ if (isPrlctl) {
|
608 | 608 | expect(result.stdout).toBeTypeOf("string"); |
609 | 609 | }); |
610 | 610 | |
| 611 | +it("does not wait for host commands that trap SIGTERM after a timeout", () => { |
| 612 | +const startedAt = Date.now(); |
| 613 | +const result = run( |
| 614 | +process.execPath, |
| 615 | +[ |
| 616 | +"-e", |
| 617 | +[ |
| 618 | +"process.on('SIGTERM', () => {});", |
| 619 | +"setTimeout(() => process.exit(77), 700);", |
| 620 | +"setInterval(() => {}, 1000);", |
| 621 | +].join(""), |
| 622 | +], |
| 623 | +{ |
| 624 | +check: false, |
| 625 | +quiet: true, |
| 626 | +timeoutMs: 50, |
| 627 | +}, |
| 628 | +); |
| 629 | + |
| 630 | +expect(result.status).toBe(124); |
| 631 | +expect(Date.now() - startedAt).toBeLessThan(500); |
| 632 | +}); |
| 633 | + |
611 | 634 | it("routes Windows host pnpm and npm shims through safe runners", () => { |
612 | 635 | const comSpec = "C:\\Windows\\System32\\cmd.exe"; |
613 | 636 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。