mirror of
https://github.com/arun11299/cpp-subprocess.git
synced 2025-08-04 12:26:19 -04:00
Do not escape double quotes for command line arguments on Windows
This change fixes the handling of double quotes and aligns the behavior with Python's `Popen` class. For example: ``` >py -3 >>> import subprocess >>> p = subprocess.Popen("cmd.exe /c dir \"C:\\Program Files\"", stdout=subprocess.PIPE, text=True) >>> print(f"Captured stdout:\n{stdout}") ``` Currently, the same command line processed by the `quote_argument()` function looks like `cmd.exe /c dir "\"C:\Program" "Files\""`, which is broken. With this change, it looks correct: `cmd.exe /c dir "C:\Program Files"`.
This commit is contained in:
parent
bbb4b84e92
commit
4dffd5b55c
@ -193,7 +193,7 @@ namespace util
|
||||
//
|
||||
|
||||
if (force == false && argument.empty() == false &&
|
||||
argument.find_first_of(L" \t\n\v\"") == argument.npos) {
|
||||
argument.find_first_of(L" \t\n\v") == argument.npos) {
|
||||
command_line.append(argument);
|
||||
}
|
||||
else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user