#53831: fix: don't start an app instance when a helper is executed without --type
Description of Change
On macOS the helper executables link the same framework as the main binary, so running one without a --type argument boots it as a full browser process from inside the helper bundle. That process derives its child helper paths from its own name (App Helper (Plugin) (GPU).app, ...), so its GPU and renderer launches fail and its sandboxed utilities abort in OverrideChildProcessPath with "Unable to find helper app", relaunching in a loop. The easiest way to get there today is child_process.fork() in an app that has the runAsNode fuse disabled: the fork wrapper points execPath at the helper and sets ELECTRON_RUN_AS_NODE=1, the fuse ignores the variable, and the helper starts as an app.
Two changes:
- Helper executables now exit with
EX_USAGEand a message when started without--type, the same guard Chrome has inChromeMainDelegate("Helper application requires --type"). Every legitimate helper launch from content carries--type. child_process.fork()throws when therunAsNodefuse is disabled instead of spawning a process that cannot work. The fuses tutorial already said fork "will not function as expected" in that configuration; it now says it throws.
Checklist
- PR description included and stakeholders cc'd
-
npm testpasses - tests are changed or added
- relevant API documentation, tutorials, and examples are updated and follow the documentation style guide
- PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, and past tense.
Release Notes
Notes: Fixed helper executables on macOS starting a second app instance when launched without a process type, for example through child_process.fork() with the runAsNode fuse disabled; fork() now throws in that configuration.
Backports
Semver Impact
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron