mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-25 20:05:46 -06:00
fix(scripts): reject short flag extension memory values
This commit is contained in:
@@ -87,7 +87,7 @@ export function parseArgs(argv) {
|
||||
case "--extension":
|
||||
case "-e": {
|
||||
const next = args[index + 1];
|
||||
if (!next) {
|
||||
if (!next || next.startsWith("-")) {
|
||||
throw new Error(`${arg} requires a value`);
|
||||
}
|
||||
options.extensions.push(next);
|
||||
@@ -112,7 +112,7 @@ export function parseArgs(argv) {
|
||||
break;
|
||||
case "--json": {
|
||||
const next = args[index + 1];
|
||||
if (!next) {
|
||||
if (!next || next.startsWith("-")) {
|
||||
throw new Error(`${arg} requires a value`);
|
||||
}
|
||||
options.jsonPath = path.resolve(next);
|
||||
|
||||
@@ -103,6 +103,21 @@ describe("scripts/profile-extension-memory", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("rejects option-looking string flag values before scanning built plugin artifacts", () => {
|
||||
for (const args of [
|
||||
["--extension", "-h"],
|
||||
["--json", "-h"],
|
||||
]) {
|
||||
const result = runProfileExtensionMemory(args);
|
||||
|
||||
expect(result.status).toBe(1);
|
||||
expect(result.stdout).toBe("");
|
||||
expect(result.stderr).toContain(`[extension-memory] ${args[0]} requires a value`);
|
||||
expect(result.stderr).not.toContain("dist/extensions");
|
||||
expect(result.stderr).not.toContain("at ");
|
||||
}
|
||||
});
|
||||
|
||||
it("bounds noisy child output without losing RSS samples", () => {
|
||||
const root = mkdtempSync(path.join(tmpdir(), "openclaw-extension-memory-test-"));
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user