userver: engine::subprocess::ProcessStarter Class Reference
Loading...
Searching...
No Matches
engine::subprocess::ProcessStarter Class Reference

#include <userver/engine/subprocess/process_starter.hpp>

Detailed Description

Creates a new OS subprocess and executes a command in it.

Definition at line 48 of file process_starter.hpp.

Public Member Functions

 ProcessStarter (TaskProcessor &task_processor)
 
ChildProcess Exec (const std::string &executable_path, const std::vector< std::string > &args, ExecOptions &&options={})
 
ChildProcess Exec (const std::string &executable_path, 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 &executable_path, 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)
 

Constructor & Destructor Documentation

◆ ProcessStarter()

engine::subprocess::ProcessStarter::ProcessStarter ( TaskProcessor & task_processor)
explicit
Parameters
task_processorwill be used for executing asynchronous fork + exec. `main-task-processor is OK for this purpose.

Member Function Documentation

◆ Exec() [1/3]

ChildProcess engine::subprocess::ProcessStarter::Exec ( const std::string & executable_path,
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
executable_paththe absolute path or relative path
argsexact args passed to the executable
envredefines all environment variables
Deprecated
Use the Exec overload taking ExecOptions

◆ Exec() [2/3]

ChildProcess engine::subprocess::ProcessStarter::Exec ( const std::string & executable_path,
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
executable_paththe absolute path or relative path
argsexact args passed to the executable
env_updatevariables 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 & executable_path,
const std::vector< std::string > & args,
ExecOptions && options = {} )
Parameters
executable_paththe absolute path or relative path. If use_path is true, and executable_path 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
argsexact args passed to the executable
optionsExecOptions settings
Exceptions
std::runtime_errorif use_path is true, executable_path contains / and PATH not in environment variables

The documentation for this class was generated from the following file: