
























@@ -137,6 +137,27 @@ function writeFakeCrabbox(binDir: string, helpText: string): string {
137137return crabboxPath;
138138}
139139140+function makeSlowVersionCrabbox(helpText: string): string {
141+const binDir = mkdtempSync(path.join(tmpdir(), "openclaw-slow-crabbox-"));
142+tempDirs.push(binDir);
143+const crabboxPath = path.join(binDir, "crabbox");
144+145+const script = [
146+"#!/usr/bin/env node",
147+"const args = process.argv.slice(2);",
148+'if (args[0] === "--version") { setTimeout(() => process.exit(0), 6_000); }',
149+`else if (args[0] === "run" && args[1] === "--help") { process.stdout.write(${JSON.stringify(helpText)}); }`,
150+].join("\n");
151+writeFileSync(crabboxPath, `${script}\n`, "utf8");
152+writeFileSync(
153+`${crabboxPath}.cmd`,
154+`@echo off\r\n"${process.execPath}" "%~dp0crabbox" %*\r\n`,
155+"utf8",
156+);
157+chmodSync(crabboxPath, 0o755);
158+return binDir;
159+}
160+140161function shellSingleQuote(value: string): string {
141162return `'${value.replaceAll("'", "'\\''")}'`;
142163}
@@ -1599,6 +1620,18 @@ describe.concurrent("scripts/crabbox-wrapper", () => {
15991620expect(result.stderr).toContain("selected binary does not advertise provider bogus");
16001621});
160116221623+it("times out hung sanity probes before rejecting the selected binary", () => {
1624+const helpText = "provider: hetzner, aws, local-container, blacksmith-testbox, or cloudflare\n";
1625+const result = runWrapper(helpText, ["--version"], {
1626+extraPathEntries: [makeSlowVersionCrabbox(helpText)],
1627+});
1628+1629+expect(result.error).toBeUndefined();
1630+expect(result.status).toBe(2);
1631+expect(result.stderr).toContain("version=unknown");
1632+expect(result.stderr).toContain("selected binary failed basic --version/--help sanity checks");
1633+});
1634+16021635it("parses provider choices from the --provider flag help format", () => {
16031636const result = runWrapper(
16041637"Usage: crabbox run [options]\n --provider hetzner|aws|local-container|blacksmith-testbox|cloudflare\n",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。