-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Closed
Description
- Electron version: 0.36.9
- Operating system: OSX
I have an application that can accept CLI arguments. I noticed when I built the app that process.argv
is not the same as when running electron while developing.
When running electron from the command line process.argv
looks like:
electron ./my-app --foo --ping=123
[
'/Users/bmann/Dev/my-app/node_modules/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron',
'./my-app',
'--foo',
'--ping=123'
]
This is good because typically when you parse CLI args you do something like:
minimist(process.argv.slice(2))
This matches what its like to use node
regularly such as node index.js --foo --ping=123
However when passing args directly to my built app, process.argv
looks like this:
./MyApp.app/Contents/MacOS/Electron --foo --ping=123
[
'/Users/bmann/Dev/MyApp.app/Contents/MacOS/Electron',
'--foo',
'--ping=123'
]
This is bad because now minimist(process.argv.slice(2))
misses the args. I get why this is happening but it is unfortunately not easy to work around, and I did not have this problem with nwjs
.
MrSaints, fxdave, brendena, mehrbat, Bistard and 1 more
Metadata
Metadata
Assignees
Labels
No labels