mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-10 00:11:19 +00:00
fix(scripts): reject unsafe startup memory timeouts
This commit is contained in:
parent
8f8162704d
commit
4fc5cf4579
2 changed files with 6 additions and 1 deletions
|
|
@ -20,7 +20,7 @@ let rssHookPath = null;
|
|||
|
||||
function readPositiveIntEnv(name, fallback, env = process.env) {
|
||||
const value = readPositiveNumberEnv(name, fallback, env);
|
||||
if (!Number.isInteger(value)) {
|
||||
if (!Number.isSafeInteger(value)) {
|
||||
throw new Error(`${name} must be a positive integer`);
|
||||
}
|
||||
return value;
|
||||
|
|
|
|||
|
|
@ -86,6 +86,11 @@ describe("check-cli-startup-memory", () => {
|
|||
OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS: "1000.5",
|
||||
}),
|
||||
).toThrow("OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS must be a positive integer");
|
||||
expect(() =>
|
||||
testing.readPositiveIntEnv("OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS", 60_000, {
|
||||
OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS: String(Number.MAX_SAFE_INTEGER + 1),
|
||||
}),
|
||||
).toThrow("OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS must be a positive integer");
|
||||
expect(
|
||||
testing.readPositiveIntEnv("OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS", 60_000, {
|
||||
OPENCLAW_STARTUP_MEMORY_TIMEOUT_MS: "1000",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue