Merge bitcoin/bitcoin#32567: subprocess: Backport upstream changes

e63a7034f0 subprocess: Don't add an extra whitespace at end of Windows command line (laanwj)

Pull request description:

  A list of the backported PRs:
  - https://github.com/arun11299/cpp-subprocess/pull/119

  The following PRs were skipped for backporting:
  - https://github.com/arun11299/cpp-subprocess/pull/118 because there is no changes in the header code.

  Required for https://github.com/bitcoin/bitcoin/pull/32566.

ACKs for top commit:
  laanwj:
    Code review ACK e63a7034f0

Tree-SHA512: 69a74aa7f9c611a9ec910e27161c5e9e147067d37f8335953cd3875fcc88dc840a2f7b206bb603f22507159e406b1449f1dc4702fffe890bb824672641b4feed
This commit is contained in:
merge-script committed 2025-05-21 12:08:36 +01:00
commit 0a56ed1ac8
1 file changed
+6 -1
+6 -1
View File
@@ -1124,11 +1124,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