Fixes #32574.
The subprocess::Popen
constructor has two overloads: https://github.com/bitcoin/bitcoin/blob/7763e86afa045910a14ac9b2cd644927a447370b/src/util/subprocess.h#L938-L941
During the migration from Boost.Process in #28981, the second was chosen for two reasons: (1) it minimized changes at the call sites, and (2) it addressed quoting issues on Windows. This approach internally uses the subprocess::util::split()
function, which currently fails to handle quoted tokens, such as in subshell invocations like sh -c 'ls; echo'
.
This issue was not caught by our tests as they are broken. The last commit fixes the system_tests/run_command
test. This commit can be applied on top of the master branch to reproduce the existing failure in subprocess
.
The second commit is intended to be upstreamed. However, I’m seeking code review feedback first (please note that the src/util/subprocess.h
code is C++11 compatible).