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:
Hennadii Stepanov 2025-04-24 16:11:25 +01:00
parent bbb4b84e92
commit 4dffd5b55c
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

View File

@ -193,7 +193,7 @@ namespace util
// //
if (force == false && argument.empty() == false && 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); command_line.append(argument);
} }
else { else {