Skip to content

fix: use process.defaultApp to detect packaged Electron app#692

Merged
mattgodbolt merged 1 commit into
mattgodbolt:mainfrom
SAY-5:claude/fix-noboot-windows-684
May 11, 2026
Merged

fix: use process.defaultApp to detect packaged Electron app#692
mattgodbolt merged 1 commit into
mattgodbolt:mainfrom
SAY-5:claude/fix-noboot-windows-684

Conversation

@SAY-5
Copy link
Copy Markdown
Contributor

@SAY-5 SAY-5 commented May 11, 2026

Fixes #684.

In getArguments the basename(argv[0]) === "jsbeeb" check never matched on Windows (the packaged binary is jsbeeb.exe), so the function fell through to argv.slice(2) and silently dropped the first user argument. That made "jsbeeb --noboot foo.dsd" appear to autoboot (--noboot was discarded and foo.dsd became disc1) and "jsbeeb foo.dsd" appear to do nothing (foo.dsd was discarded).

Switched to process.defaultApp, which Electron sets only when running electron . in development, so the dev/packaged distinction is reliable across Linux, macOS, and Windows. Extracted getArguments into src/app/args.js so it can be unit-tested without booting Electron, and added tests/unit/test-app-args.js covering the Windows .exe case, the macOS .app/.../jsbeeb path, the Linux packaged path, dev mode, and the Chrome-flag filter.

The basename(argv[0]) === "jsbeeb" check never matched on Windows,
where the packaged binary is jsbeeb.exe, so getArguments fell through
to argv.slice(2) and silently dropped the first user argument. As a
result "jsbeeb --noboot foo.dsd" autobooted (--noboot was discarded
and foo.dsd became disc1) and "jsbeeb foo.dsd" did nothing
(foo.dsd was discarded).

Switch to process.defaultApp, which Electron sets only when running
`electron .` in development, so the dev/packaged distinction is
correct on every OS. Extracted getArguments into its own module so it
can be unit-tested without booting Electron.

Fixes mattgodbolt#684.
Copy link
Copy Markdown
Owner

@mattgodbolt mattgodbolt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool! thank you!

@mattgodbolt mattgodbolt merged commit 653a5f2 into mattgodbolt:main May 11, 2026
1 check passed
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.

--noboot behavior inverted

2 participants