nit: Could potentially switch to string_view here and at the call site to avoid potential heap allocation from string.
(Builds successfully on Windows CI - https://github.com/hodlinator/bitcoin/actions/runs/31177630989/job/92863107266).
diff --git a/src/util/exec.cpp b/src/util/exec.cpp
index 69361fbc51..9a942eff58 100644
--- a/src/util/exec.cpp
+++ b/src/util/exec.cpp
@@ -28,7 +28,7 @@ int ExecVp(const char* file, char* const argv[])
#else
std::vector<std::string> escaped_args;
for (char* const* arg_ptr{argv}; *arg_ptr; ++arg_ptr) {
- subprocess::util::quote_argument(std::string{*arg_ptr}, escaped_args.emplace_back(), /*force=*/false);
+ subprocess::util::quote_argument(std::string_view{*arg_ptr}, escaped_args.emplace_back(), /*force=*/false);
}
std::vector<const char*> new_argv;
diff --git a/src/util/subprocess.h b/src/util/subprocess.h
index 5a64b116ad..8a7c5e5244 100644
--- a/src/util/subprocess.h
+++ b/src/util/subprocess.h
@@ -162,7 +162,7 @@ public:
namespace util
{
#ifdef WIN32
- inline void quote_argument(const std::string &argument, std::string &command_line,
+ inline void quote_argument(std::string_view argument, std::string &command_line,
bool force)
{
constexpr char quote = '"';