Skip to content

Support Electron process.argv structure, prevent first arg being lost #103

Open
@mattdwen

Description

@mattdwen

I'm running v5.1.1 in an Electron app.

I have the following code

const optionDefinitions = [
  { name: 'debug', type: Boolean },
  { name: 'divafsDisable', type: Boolean },
  { name: 'serve', type: Boolean }
];
const options = commandLineArgs(optionDefinitions);

console.error('options', options);
console.error('argv', process.argv);

I am then executing:

C:\Projects\diva4\dist\client\win-unpacked\DIVAClient.exe --debug --divafsDisable

And I get the following output:

options { divafsDisable: true }
argv [ 'C:\\Projects\\diva4\\dist\\client\\win-unpacked\\DIVAClient.exe',
  '--debug',
  '--divafsDisable' ]

If I pass just a single argument then the options has no properties defined.

I've also tried directly passing in process.argv with the same result.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions