Gazebo Utils

API Reference

2.2.0

Create a RAII-type object that encapsulates a subprocess. More...

#include <Subprocess.hh>

Public Member Functions

 Subprocess (const std::vector< std::string > &_commandLine)
 Constructor. More...
 
 Subprocess (const std::vector< std::string > &_commandLine, const EnvironmentStrings &_environment)
 Constructor. More...
 
 Subprocess (const std::vector< std::string > &_commandLine, EnvironmentMap _environment)
 Constructor. More...
 
 ~Subprocess ()
 
bool Alive ()
 
int Join ()
 
std::string Stderr ()
 
std::string Stdout ()
 
bool Terminate ()
 

Protected Attributes

std::vector< std::stringcommandLine
 
EnvironmentMap environment
 
bool inheritEnvironment
 
subprocess_s * process {nullptr}
 

Detailed Description

Create a RAII-type object that encapsulates a subprocess.

Constructor & Destructor Documentation

◆ Subprocess() [1/3]

Subprocess ( const std::vector< std::string > &  _commandLine)
inlineexplicit

Constructor.

This variant will spawn a subprocess that inherits the environment from the calling process.

Parameters
[in]_commandLineset of arguments starting with an executable used to spawn the subprocess

◆ Subprocess() [2/3]

Subprocess ( const std::vector< std::string > &  _commandLine,
EnvironmentMap  _environment 
)
inline

Constructor.

This variant will spawn a subprocess that uses the user-specified environment

Parameters
[in]_commandLineset of arguments starting with an executable used to spawn the subprocess
[in]_environmentenvironment variables to set in the spawned subprocess

◆ Subprocess() [3/3]

Subprocess ( const std::vector< std::string > &  _commandLine,
const EnvironmentStrings _environment 
)
inline

Constructor.

This variant will spawn a subprocess that uses the user-specified environment

Parameters
[in]_commandLineset of arguments starting with an executable used to spawn the subprocess
[in]_environmentenvironment variables to set in the spawned subprocess

◆ ~Subprocess()

~Subprocess ( )
inline

References Subprocess::process.

Member Function Documentation

◆ Alive()

bool Alive ( )
inline

References Subprocess::process.

◆ Join()

int Join ( )
inline

References std::endl(), and Subprocess::process.

◆ Stderr()

std::string Stderr ( )
inline

References Subprocess::process.

◆ Stdout()

std::string Stdout ( )
inline

References Subprocess::process.

◆ Terminate()

bool Terminate ( )
inline

References Subprocess::process.

Member Data Documentation

◆ commandLine

std::vector<std::string> commandLine
protected

◆ environment

EnvironmentMap environment
protected

◆ inheritEnvironment

bool inheritEnvironment
protected

◆ process


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