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

Arguments not translated correctly #6

Open
AgentOak opened this issue Sep 30, 2018 · 1 comment
Open

Arguments not translated correctly #6

AgentOak opened this issue Sep 30, 2018 · 1 comment

Comments

@AgentOak
Copy link

AgentOak commented Sep 30, 2018

Hi,

I'm running v2.3 on Windows 10 x64 1803 with Debian installed in WSL and I installed wsl-alias using the provided installer. I've encountered several problems.

I've added an alias for php like this:

C:\Users\Me>b wsl-alias add php php

To verify it really is running from WSL:

C:\Users\Me>php -a
Interactive mode enabled

php > system("uname");
Linux

Running files using a relative path works:

C:\Users\Me>php Documents\Projects\test.php

Using a full path however, does not:

C:\Users\Me>php C:\Users\Me\Documents\Projects\test.php
Could not open input file: C:/Users/Me/Documents/Projects/test.php

Also, some special characters in arguments cause problems. Parantheses will not work:

C:\Users\Me>php -r "exit()"
/bin/bash: -c: line 0: syntax error near unexpected token `('
/bin/bash: -c: line 0: `~/.wsl-alias/wrapper.sh 'C:\\Users\\Me' php -r \"exit()\"'

Semicolons will also cause errors:

C:\Users\Me>php -r "exit;"
/home/me/.wsl-alias/wrapper.sh: eval: line 41: unexpected EOF while looking for matching `"'
/home/me/.wsl-alias/wrapper.sh: eval: line 42: syntax error: unexpected end of file

Let me know if I can be of any help.

EDIT: For clarification, running these commands without wsl-alias using only the native wsl, all special characters work:

C:\Users\Me>wsl php -r "printf('Test(\"Test\");');"
Test("Test");
@leongrdic
Copy link
Owner

Hello and thanks for your detailed description of the problem!
I'm unfortunately aware of the issue, however I'm not really sure what I can do to fix this behavior.

The problem originates in the different ways cmd and powershell interpret arguments passed to a script and wsl-alias trying to be maximally compatible with both.
I noticed you're using cmd, and if you tried running the last command in your issue in powershell, it wouldn't work because powershell ommits the first doubleqoutes from the params..

I am still quite unsure about how to approach this problem - I could remove powershell escaping support and extend the cmd syntax support (to match the native wsl command behavior) or keep it this way with limited functionality in both ps and cmd..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants