-
Notifications
You must be signed in to change notification settings - Fork 92
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
Issue with quotes on windows #90
Comments
@santaclose Is your last PR related to this ? On a side note, you could try raw string
|
Seems to me the issue can be solved just by removing But there must be a reason why @xoviat added it. And also, why was the |
This may have been implemented incorrectly. See here for the correct implementation: https://learn.microsoft.com/en-us/archive/blogs/twistylittlepassagesallalike/everyone-quotes-command-line-arguments-the-wrong-way |
In fact it appears that the initial implementation was correct and your PR may have introduced a bug. It also appears that you are attempting to use the shell functionality on Windows which is not currently supported. |
thanks for the info, the only commit that was meant to be merged was the one with the call function overload, the solution for the quote issue is something temporary I pushed to my branch. Then, from what you say, I understand I need shell functionality to run the explorer executable with the select argument? |
With the code before your PR was merged, you should have been able to pass the executable and arguments as an initializer list, not as one command line string. If that was not the case I can look into the issue further. |
you mean like this?
this is at commit |
for reference, this python code seems to work fine: import subprocess
subprocess.run(r'explorer /select,"C:\Windows"') i think this library should work when given that same string |
see here for example: https://github.com/arun11299/cpp-subprocess/pull/91/files#diff-48ccdd15ee47b10be5729d81fb1ee3d6b0a37e113ffc53877a203300d8188b4dR43
in principle I agree. however, I think the more important functionality is to sanitize arguments when given a list. this is a large part of the reason I added this in the first place and hard to do right. |
I'm not sure exactly what python does but it may select behavior based on whether it's passed a list or not. |
yeah probably. Also, Is there a reason why you were forcing quotes? that was pretty much bypassing most of the function logic. |
@arun11299 I will work on this more after the CI pr is merged. I think it's important to have CI running first to prevent regressions. |
I'm trying to run this command
explorer /select,"C:\Windows"
usingsubprocess::call
, it should open a file explorer window with the "Windows" folder selected. However, the library always ends up surrounding all arguments with double quotes, and my double quotes are prepended with an extra backslash, causing the file explorer to open the "Documents" folder (no idea why). So, how should I use the library to run this specific command? I tried passing both, a vector and a string to the call command. Maybe something needs to be tweaked so arguments are not always surrounded with double quotes?The text was updated successfully, but these errors were encountered: