21 std::vector<const char*> args;
23 args.reserve(args_array.size());
24 for(
const auto& arg : args_array)
26 args.emplace_back(arg.c_str());
28 args.emplace_back(
nullptr);
39 result.
out_output =
"Failed to create subprocess for " + args_array.front();
46 char out_buffer[1024];
47 char err_buffer[1024];
49 auto read_all_stdout = [&]()
54 out_buffer[bytes_read] =
'\0';
59 auto read_all_stderr = [&]()
64 err_buffer[bytes_read] =
'\0';
100inline auto call(
const std::string& process,
const std::vector<std::string>& args_array = {}) -> call_result
102 std::vector<std::string> merged{process};
103 merged.insert(merged.end(), args_array.begin(), args_array.end());
auto call(const std::vector< std::string > &args_array) -> call_result
subprocess_weak unsigned subprocess_read_stdout(struct subprocess_s *const process, char *const buffer, unsigned size)
Read the standard output from the child process.
@ subprocess_option_search_user_path
@ subprocess_option_inherit_environment
@ subprocess_option_combined_stdout_stderr
subprocess_weak int subprocess_join(struct subprocess_s *const process, int *const out_return_code)
Wait for a process to finish execution.
subprocess_weak unsigned subprocess_read_stderr(struct subprocess_s *const process, char *const buffer, unsigned size)
Read the standard error from the child process.
subprocess_weak int subprocess_destroy(struct subprocess_s *const process)
Destroy a previously created process.
subprocess_weak int subprocess_create(const char *const command_line[], int options, struct subprocess_s *const out_process)
Create a process.
subprocess_weak int subprocess_alive(struct subprocess_s *const process)
Returns if the subprocess is currently still alive and executing.