Skip to content

Commit

Permalink
refactor!: drop handling of electron arguments (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoe authored May 22, 2022
1 parent 481156a commit a2ffd53
Showing 1 changed file with 0 additions and 18 deletions.
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

0 comments on commit a2ffd53

Please sign in to comment.