mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-09 02:59:31 +08:00
subprocess: Don't add an extra whitespace at end of Windows command line
The windows code adds an unnecessary extra space to the command line. This can cause subtle issues, so avoid it. Github-Pull: arun11299/cpp-subprocess#119 Rebased-From: 777cfa77d1f84bb08b3e445d5f7fc6c87282223b
This commit is contained in:
committed by
Hennadii Stepanov
parent
af65fd1a33
commit
e63a7034f0
@@ -1124,11 +1124,16 @@ inline void Popen::execute_process() noexcept(false)
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||
std::wstring argument;
|
||||
std::wstring command_line;
|
||||
bool first_arg = true;
|
||||
|
||||
for (auto arg : this->vargs_) {
|
||||
if (!first_arg) {
|
||||
command_line += L" ";
|
||||
} else {
|
||||
first_arg = false;
|
||||
}
|
||||
argument = converter.from_bytes(arg);
|
||||
util::quote_argument(argument, command_line, false);
|
||||
command_line += L" ";
|
||||
}
|
||||
|
||||
// CreateProcessW can modify szCmdLine so we allocate needed memory
|
||||
|
||||
Reference in New Issue
Block a user