Skip to content

fix(hermes): Policy.ts CLI no longer discards the destination when --launcher is absent - #1863

Open
hjbrandt wants to merge 1 commit into
danielmiessler:mainfrom
hjbrandt:fix/policy-cli-dest-without-launcher
Open

fix(hermes): Policy.ts CLI no longer discards the destination when --launcher is absent#1863
hjbrandt wants to merge 1 commit into
danielmiessler:mainfrom
hjbrandt:fix/policy-cli-dest-without-launcher

Conversation

@hjbrandt

Copy link
Copy Markdown

Fixes #1859.

Policy.ts's CLI filters --launcher and its value out of argv before reading the positional destination:

const positional = argv.filter((a, i) => a !== "--launcher" && i !== launcherIdx + 1);

When --launcher is absent, launcherIdx is -1 and i !== launcherIdx + 1 excludes index 0 — the destination itself. bun Policy.ts <dest> then prints to stdout and never writes the file, exit 0.

Change (one file, LifeOS/install/LIFEOS/HERMES/Policy.ts): guard the sentinel value so the value-slot exclusion only applies when --launcher was actually passed.

Verified: bun Policy.ts /tmp/policy.json writes the file and prints the ✓ policy v… line; bun Policy.ts --launcher name /tmp/policy.json unchanged; no-arg stdout form unchanged.

…launcher is absent

When --launcher is not passed, launcherIdx is -1 and the filter's
'i !== launcherIdx + 1' excludes argv[0] — the destination itself —
so 'bun Policy.ts <dest>' prints to stdout and never writes the file,
exit 0. Guard the sentinel: only skip the value slot when --launcher
was actually passed.

Fixes danielmiessler#1859
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Policy.ts CLI silently discards its destination argument when --launcher is absent

1 participant