Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: drop handling of electron arguments #121

Merged
merged 1 commit into from
May 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,8 @@ const {
} = require('./errors');

function getMainArgs() {
// This function is a placeholder for proposed process.mainArgs.
// Work out where to slice process.argv for user supplied arguments.

// Electron is an interesting example, with workarounds implemented in
// Commander and Yargs. Hopefully Electron would support process.mainArgs
// itself and render this workaround moot.
//
// In a bundled Electron app, the user CLI args directly
// follow executable. (No special processing required for unbundled.)
// 1) process.versions.electron is either set by electron, or undefined
// see: https://www.electronjs.org/docs/latest/api/process#processversionselectron-readonly
// 2) process.defaultApp is undefined in a bundled Electron app, and set
// in an unbundled Electron app
// see: https://www.electronjs.org/docs/latest/api/process#processdefaultapp-readonly
// (Not included in tests as hopefully temporary example.)
/* c8 ignore next 3 */
if (process.versions?.electron && !process.defaultApp) {
return ArrayPrototypeSlice(process.argv, 1);
}

// Check node options for scenarios where user CLI args follow executable.
const execArgv = process.execArgv;
if (ArrayPrototypeIncludes(execArgv, '-e') ||
Expand Down