mirror of
https://github.com/arun11299/cpp-subprocess.git
synced 2025-08-05 04:46:21 -04:00
windows: Don't add an extra whitespace at end of Windows command line (#119)
The windows code adds an unnecessary extra space to the command line. This can cause subtle issues, so avoid it.
This commit is contained in:
parent
f6232a7f26
commit
777cfa77d1
@ -1541,11 +1541,16 @@ inline void Popen::execute_process() noexcept(false)
|
|||||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||||
std::wstring argument;
|
std::wstring argument;
|
||||||
std::wstring command_line;
|
std::wstring command_line;
|
||||||
|
bool first_arg = true;
|
||||||
|
|
||||||
for (auto arg : this->vargs_) {
|
for (auto arg : this->vargs_) {
|
||||||
|
if (!first_arg) {
|
||||||
|
command_line += L" ";
|
||||||
|
} else {
|
||||||
|
first_arg = false;
|
||||||
|
}
|
||||||
argument = converter.from_bytes(arg);
|
argument = converter.from_bytes(arg);
|
||||||
util::quote_argument(argument, command_line, false);
|
util::quote_argument(argument, command_line, false);
|
||||||
command_line += L" ";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateProcessW can modify szCmdLine so we allocate needed memory
|
// CreateProcessW can modify szCmdLine so we allocate needed memory
|
||||||
|
Loading…
x
Reference in New Issue
Block a user