Skip to content

Commit 019dd0e

Browse files
fix(scripts): treat whitespace-only force-kill delay as unset (#120284)
Punchcard-Session: calm-harbor-willow-ty Co-authored-by: Peter Steinberger <[email protected]>
1 parent d40c21b commit 019dd0e

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎scripts/run-with-env.mjs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ export function resolveSpawnCommand(
7777
*/
7878
export function resolveForceKillDelayMs(env = process.env) {
7979
const raw = env.OPENCLAW_RUN_WITH_ENV_FORCE_KILL_MS;
80-
if (raw === undefined || raw === "") {
80+
const text = raw?.trim();
81+
if (!text) {
8182
return 5_000;
8283
}
83-
const text = raw.trim();
8484
if (!/^\d+$/u.test(text)) {
8585
throw new Error("OPENCLAW_RUN_WITH_ENV_FORCE_KILL_MS must be a positive integer");
8686
}

‎test/scripts/run-with-env.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ describe("run-with-env", () => {
175175

176176
it("rejects malformed force-kill grace configuration before spawning", () => {
177177
expect(resolveForceKillDelayMs({})).toBe(5_000);
178+
expect(resolveForceKillDelayMs({ OPENCLAW_RUN_WITH_ENV_FORCE_KILL_MS: " " })).toBe(5_000);
178179
expect(resolveForceKillDelayMs({ OPENCLAW_RUN_WITH_ENV_FORCE_KILL_MS: "250" })).toBe(250);
179180
expect(
180181
resolveForceKillDelayMs({

0 commit comments

Comments
 (0)