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

Shell quoting is wrong on Windows #1325

lefth opened this Issue Dec 20, 2017 · 2 comments


None yet
2 participants

lefth commented Dec 20, 2017

I first noticed this issue in 2017.11 (MoarVM 2017.11). Git bisect showed that the problem was introduced by commit 40dd369.

To reproduce, run the following in rakudo on Windows (assuming you have perl installed and in the path):
shell 'perl -e "require v5.12;"'
Expected output: no output, a Proc with exitcode => 0. Actual output:
Can't find string terminator '"' anywhere before EOF at -e line 1.
and a Proc with exitcode => 255.

Other commands also silently fail, like qx/python -c "print(4)"/. Commands with no quoting such as shell('echo 4') succeed.

All of the above work as expected before commit 40dd369.


This comment has been minimized.


zoffixznet commented Dec 20, 2017

Some more discussion on this:
Notable notes:

  • This happens on cygwin too
  • Works fine in Perl 5

Also closed but related RFC: #1306


This comment has been minimized.

lefth commented Dec 20, 2017

I think rakudo should not quote/escape/modify of the argument in shell($cmd). The whole point of that function is to let the shell do all the parsing. The alternative is to take the string, parse it into separate arguments (hoping we obey the same rules as the system shell), then re-package those arguments in a format the system shell can understand. That approach has one advantage[1], but it's feature creep. CMD takes one argument, and so does shell. Passing it through unchanged is the obvious answer.

1: It is annoying that quotes used in the shell call will be platform-dependent. perl -e '' will be invalid on Windows, but perl -e "" will be valid on most common shells. However, that's not rakudo's problem--just like you can't call shell("ls") on Windows, you can't call a command with incorrect quoting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment