-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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
os.Args is missing/eating/interpreting double quote on Windows #30952
Comments
I'm fairly sure Go on windows goes to extensive lengths to mimic how windows internally parses arguments. Doing a test right now even windows isn't consistent. On powershell I got similar results as above, but on windows cmd I get different results. I believe most of windows uses the same argument parser the cmd terminal demonstrates. What you are finding is a limitation of the design in windows itself. Yes, Go is interpreting the arguments. That's how windows works. |
Hum, ok, I just tested again using Python: #!/usr/bin/env python
import sys, subprocess
subprocess.run(['test.exe', '"'], stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr) Also I found https://stackoverflow.com/questions/6714165/powershell-stripping-double-quotes-from-command-line-arguments
-_- ... Sorry for the noise. Edit: more references |
http://daviddeley.com/autohotkey/parameters/parameters.htm#WIN for people who get exited about things like that. Alex |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
When passing quotes (properly escaped) as arguments, Go doesn't restitue them in os.Args.
Go seems to be interpreting the quotes in lieu of the shell (PowerShell here).
Example:
(Or with a single quote:
)
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: