* Overload of 'subprocess' for launching a shell command, i.e., 'sh * -c command'. * * Currently, we do not support flags for shell command variants due * to the complexity involved in escaping quotes in flags. * * @param command Shell command to execute. * @param in Redirection specification for stdin. * @param out Redirection specification for stdout. * @param err Redirection specificat
| 402 | // TODO(jmlvanre): Consider removing default argument for |
| 403 | // `parent_hooks` to force the caller to think about setting them. |
| 404 | inline Try<Subprocess> subprocess( |
| 405 | const std::string& command, |
| 406 | const Subprocess::IO& in = Subprocess::FD(STDIN_FILENO), |
| 407 | const Subprocess::IO& out = Subprocess::FD(STDOUT_FILENO), |
| 408 | const Subprocess::IO& err = Subprocess::FD(STDERR_FILENO), |
| 409 | const Option<std::map<std::string, std::string>>& environment = None(), |
| 410 | const Option<lambda::function< |
| 411 | pid_t(const lambda::function<int()>&)>>& clone = None(), |
| 412 | const std::vector<Subprocess::ParentHook>& parent_hooks = {}, |
| 413 | const std::vector<Subprocess::ChildHook>& child_hooks = {}, |
| 414 | const std::vector<int_fd>& whitelist_fds = {}) |
| 415 | { |
| 416 | std::vector<std::string> argv = {os::Shell::arg0, os::Shell::arg1, command}; |
| 417 | |
| 418 | return subprocess( |
| 419 | os::Shell::name, |
| 420 | argv, |
| 421 | in, |
| 422 | out, |
| 423 | err, |
| 424 | nullptr, |
| 425 | environment, |
| 426 | clone, |
| 427 | parent_hooks, |
| 428 | child_hooks, |
| 429 | whitelist_fds); |
| 430 | } |
| 431 | |
| 432 | } // namespace process { |
| 433 |