fix(scripts): reject unsafe startup memory timeouts · openclaw/openclaw@4fc5cf4
vincentkoc
·
2026-06-19
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -20,7 +20,7 @@ let rssHookPath = null;
|
20 | 20 | |
21 | 21 | function readPositiveIntEnv(name, fallback, env = process.env) { |
22 | 22 | const value = readPositiveNumberEnv(name, fallback, env); |
23 | | -if (!Number.isInteger(value)) { |
| 23 | +if (!Number.isSafeInteger(value)) { |
24 | 24 | throw new Error(`${name} must be a positive integer`); |
25 | 25 | } |
26 | 26 | return value; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -86,6 +86,11 @@ describe("check-cli-startup-memory", () => {
|
86 | 86 | OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS: "1000.5", |
87 | 87 | }), |
88 | 88 | ).toThrow("OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS must be a positive integer"); |
| 89 | +expect(() => |
| 90 | +testing.readPositiveIntEnv("OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS", 60_000, { |
| 91 | +OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS: String(Number.MAX_SAFE_INTEGER + 1), |
| 92 | +}), |
| 93 | +).toThrow("OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS must be a positive integer"); |
89 | 94 | expect( |
90 | 95 | testing.readPositiveIntEnv("OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS", 60_000, { |
91 | 96 | OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS: "1000", |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。