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
Wrong $0 in bundled electron app #685
Comments
same issue here. |
@zinwalin @acromarco does this continue to be an issue? I wonder if we could detect we're in an electron environment and potentially handle our slicing a bit differently. |
I was looking into this in weekend (in context of Commander). References:
Still a WIP, detection:
and decision about where to slice:
|
@shadowspawn This would indeed solve the first half of this issue ( However, @acromarco also reported that it first flag ( Is is something you can reproduce too? |
|
@shadowspawn The master branch should now be OK for your use case (ie @zinwalin @acromarco Could one of you please give us some feedback about the 2nd point ("notice that the $0 ist still wrong because it contains the "-f") reported in the initial issue? |
(Disclaimer: I do not currently use yargs or electron for real, just an interested third party!)
From experimentation Line 5 in a8ce123
|
@shadowspawn @mleguen reading the issue linked, it sounds like they were suggesting only slicing at 0 when we know the electron app is bundled, via, |
I tracked down the supporting docs:
|
@zcbenz @MarshallOfSound, recommendation on how we should best detect a should we be checking for |
@bcoe Checking |
@shadowspawn Thanks for the tests, and pointing to the doc. So I am going to replace my
EDIT: checking 2nd EDIT: nothing wrong in electron's doc as I initialy stated: |
@shadowspawn 2nd fixed merged into master: ready for testing, if you don't mind. |
Working fine now in my tests, args getting sliced at correct point. |
@shadowspawn thanks for helping to sort this out. |
We have an election app that is bundled to an .exe file.
A command line like
bundled.exe -f filename
will result in:
{ _: ['filename'], '$0': 'bundled.exe -f' }
The following workaround:
const argv = yargs.parse(process.argv.slice(1));
will result in
{ _: [], f: 'filename', '$0': 'bundled.exe -f' }
Please notice that the $0 ist still wrong because it contains the "-f".
If this an expected behavior? Is there a way to work around it?
The text was updated successfully, but these errors were encountered: