-
Notifications
You must be signed in to change notification settings - Fork 2k
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
process.argv behaves differently to nodejs #1752
Comments
I'm not sure, but I think it's a feature. Update: as expected, this is a feature. > coffee test.js --myargs |
A quick look yielded some results. edit: edit: thought of a solution: keep the original argument list and do an |
@yuchi: |
Ops... looks like the correct behaviour to me. Thanks @michaelficarra |
@chrislloyd: fixed by e686e3f |
Bam! That's service for you. Thanks! |
I'm afraid this issue is not resolved.
|
I just verified that e686e3f really did fix this issue. There must have been a regression in the meantime.
Please reopen this issue. I will comment again with the commit that re-introduced the bug and then leave it to you (unless a fix is obvious to me). |
The bug was re-introduced in c0dac45: (and never "re-fixed" in the meantime)
Bisection:
|
Thanks for finding c0dac45 :). |
Well, thanks for fixing it :) |
The desired behavior is achieved by $ ./bin/coffee argv.js -- -myargs
[ 'coffee',
'/path/to/coffee-script/argv.js',
'-myargs'] Close? |
Ok, so
which explicitly states the
As this is documented to work this way, I would accept this issue to get closed. |
@felixrabe I don't know. It is documented, yes; but if you're not familiar with the I think the reasonable behavior would be to pass all arguments after the script name untouched, at least if not compiling. |
Unless I'm very much mistaken, not all versions of env work the same, or I'm calling it incorrectly. Prefacing a coffeescript file with #!/usr/bin/env coffee --
console.log process.argv fails when run with the error |
So I did some reading and found this thread which states that some operating systems parse the The best way to deal with this that I can think of is (if there is no |
Pass arguments to executable script unchanged if using "#!/usr/bin/env coffee". (Previously, "./test.coffee -abck" would be turned into "-a -b -c -k", for example.) Fixes jashkenas#1752.
As commented above, this is documented in |
* Add #! support for executable scripts on Linux. Pass arguments to executable script unchanged if using "#!/usr/bin/env coffee". (Previously, "./test.coffee -abck" would be turned into "-a -b -c -k", for example.) Fixes #1752. * refactor option parsing clean up parsing code and in the process fix oustanding bug where coffeescript modified arguments meant for an executable script * address comments * intermediate save * add note saying where OptionParser is used in coffee command * add some more work * fix flatten functions * refactor tests * make argument processing less confusing * add basic test * remove unused file * compilation now hangs * remove unnecessary changes * add tests!!! * add/fix some tests * clarify a test * fix helpers * fix opt parsing * fix infinite loop * make rule building easier to read * add tests for flag overlap * revamp argument parsing again and add more thorough testing * add tests, comment, clean unused method * address review comments * add test for direct invocation of shebang scripts * move shebang parsing test to separate file and check for browser * remove TODO * example backwards compatible warnings * add correct tests for warning 1 * add tests for warnings * commit output js libs and update docs * respond to review comments also add tests for help text * respond to review comments * fix example output * Rewrite argument parsing documentation to be more concise; add it to sidebar and body; add new output * Don’t mention deprecated syntax; clean up variable names
In a file (both valid coffee script and vanilla JS):
then call with:
and
CoffeScript still interprets flags after the script name.
The text was updated successfully, but these errors were encountered: