Skip to content
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

`nim c -r main.nim foo1 "" foo3` doesn't handle empty params or params w quotes #9842

Closed
timotheecour opened this issue Dec 2, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@timotheecour
Copy link
Contributor

commented Dec 2, 2018

nim c -r main.nim foo1 "" foo3 skips empty param:

import os
proc main()=
  echo commandLineParams()
main()
nim c -r $timn_D/tests/nim/all/t0016.nim foo1 foo2 "" foo4
@["foo1", "foo2", "foo4"]
# expected: @["foo1", "foo2", "", "foo4"]

it works only if we compile first, and THEN run

$timn_D/tests/nim/all/t0016 foo1 foo2 "" foo4
@["foo1", "foo2", "", "foo4"]

in D, this works fine:

import std.stdio;
void main(string[]args){
  writeln(args);
}

dmd -run $timn_D/tests/nim/all/t0017.d foo1 foo2 "" foo3
["/var/tmp/dmd_run080TTh", "foo1", "foo2", "", "foo3"]

@Araq

This comment has been minimized.

Copy link
Member

commented Dec 4, 2018

And once it "works" it's totally obfuscated code that should be rewritten.

timotheecour added a commit to timotheecour/Nim that referenced this issue Jan 13, 2019

timotheecour added a commit to timotheecour/Nim that referenced this issue Jan 13, 2019

@timotheecour

This comment has been minimized.

Copy link
Contributor Author

commented Jan 13, 2019

it's also broken with arguments that contain quotes or single quotes; I wrote a PR that fixes this and adds test case, see #10291

@timotheecour timotheecour self-assigned this Jan 13, 2019

@timotheecour timotheecour changed the title `nim c -r main.nim foo1 "" foo3` skips empty param `nim c -r main.nim foo1 "" foo3` doesn't handle empty params or params w quotes Jan 13, 2019

timotheecour added a commit to timotheecour/Nim that referenced this issue Jan 14, 2019

timotheecour added a commit to timotheecour/Nim that referenced this issue Jan 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.