#include <userver/engine/subprocess/process_starter.hpp>
Creates a new OS subprocess and executes a command in it.
Definition at line 48 of file process_starter.hpp.
|
| ProcessStarter (TaskProcessor &task_processor) |
|
ChildProcess | Exec (const std::string &command, const std::vector< std::string > &args, ExecOptions &&options={}) |
|
ChildProcess | Exec (const std::string &command, const std::vector< std::string > &args, const EnvironmentVariables &env, const std::optional< std::string > &stdout_file=std::nullopt, const std::optional< std::string > &stderr_file=std::nullopt) |
|
ChildProcess | Exec (const std::string &command, const std::vector< std::string > &args, EnvironmentVariablesUpdate env_update, const std::optional< std::string > &stdout_file=std::nullopt, const std::optional< std::string > &stderr_file=std::nullopt) |
|
◆ ProcessStarter()
engine::subprocess::ProcessStarter::ProcessStarter |
( |
TaskProcessor & | task_processor | ) |
|
|
explicit |
- Parameters
-
task_processor | will be used for executing asynchronous fork + exec. `main-task-processor is OK for this purpose. |
◆ Exec() [1/3]
ChildProcess engine::subprocess::ProcessStarter::Exec |
( |
const std::string & | command, |
|
|
const std::vector< std::string > & | args, |
|
|
const EnvironmentVariables & | env, |
|
|
const std::optional< std::string > & | stdout_file = std::nullopt, |
|
|
const std::optional< std::string > & | stderr_file = std::nullopt ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
- Parameters
-
command | the absolute path or relative path |
args | exact args passed to the executable |
env | redefines all environment variables |
- Deprecated
- Use the
Exec
overload taking ExecOptions
◆ Exec() [2/3]
ChildProcess engine::subprocess::ProcessStarter::Exec |
( |
const std::string & | command, |
|
|
const std::vector< std::string > & | args, |
|
|
EnvironmentVariablesUpdate | env_update, |
|
|
const std::optional< std::string > & | stdout_file = std::nullopt, |
|
|
const std::optional< std::string > & | stderr_file = std::nullopt ) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
- Parameters
-
command | the absolute path or relative path |
args | exact args passed to the executable |
env_update | variables to add to the current environment, overwriting existing ones |
- Deprecated
- Use the
Exec
overload taking ExecOptions
◆ Exec() [3/3]
ChildProcess engine::subprocess::ProcessStarter::Exec |
( |
const std::string & | command, |
|
|
const std::vector< std::string > & | args, |
|
|
ExecOptions && | options = {} ) |
- Parameters
-
command | the absolute path or relative path. If use_path is true , and command does not contains / , then it will be searched in the colon-separated list of directory pathnames specified in the PATH environment variable. More details ExecOptions::use_path |
args | exact args passed to the executable |
options | ExecOptions settings |
- Exceptions
-
std::runtime_error | if use_path is true , command contains / and PATH not in environment variables |
The documentation for this class was generated from the following file: