|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace { |
|
|
namespace { |
|
|
|
|
|
|
|
|
[[noreturn]] void throw_system_error(const char* what) { |
|
|
|
|
|
|
|
|
[[noreturn]] void throw_system_error(std::string what) { |
|
|
throw std::system_error(std::error_code(::GetLastError(), std::system_category()), what); |
|
|
throw std::system_error(std::error_code(::GetLastError(), std::system_category()), what); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
&startup_info, |
|
|
&startup_info, |
|
|
&proc_info); |
|
|
&proc_info); |
|
|
if (!okay) { |
|
|
if (!okay) { |
|
|
throw_system_error("Failed to spawn a child process"); |
|
|
|
|
|
|
|
|
throw_system_error(fmt::format("Failed to spawn child process [{}]", cmd_str)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
writer.reset(); |
|
|
writer.reset(); |