Public Member Functions | Public Attributes | Protected Member Functions

wibble::sys::Exec Class Reference

Execute external commands, either forked as a ChildProcess or directly using exec(). More...

#include <exec.h>

Inheritance diagram for wibble::sys::Exec:
Inheritance graph
[legend]
Collaboration diagram for wibble::sys::Exec:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~Exec ()
 Exec (const std::string &pathname)
 Create a new object that will execute program `program'.
void importEnv ()
 Import the current environment into env.
void exec ()
 exec the program, never returning if all goes well

Public Attributes

std::string pathname
 Filename or pathname of the program to execute.
std::vector< std::string > args
 Arguments for the process to execute.
std::vector< std::string > env
 Custom environment for the child process, if envFromParent is false.
bool envFromParent
 True if the environment is to be taken from the parent, false if it is explicitly provided in env.
bool searchInPath
 Set to true if the file is to be searched in the current $PATH.

Protected Member Functions

virtual int main ()
 Used to run the program as a child process, if one of the ChildProcess::fork functions is called.

Detailed Description

Execute external commands, either forked as a ChildProcess or directly using exec().


Constructor & Destructor Documentation

virtual wibble::sys::Exec::~Exec (  )  [inline, virtual]
wibble::sys::Exec::Exec ( const std::string &  pathname  )  [inline]

Create a new object that will execute program `program'.

References args.


Member Function Documentation

void wibble::sys::Exec::exec (  ) 

exec the program, never returning if all goes well

References args, env, envFromParent, environ, pathname, and searchInPath.

Referenced by main().

void wibble::sys::Exec::importEnv (  ) 

Import the current environment into env.

References env, and environ.

int wibble::sys::Exec::main (  )  [protected, virtual]

Used to run the program as a child process, if one of the ChildProcess::fork functions is called.

Simply calls exec()

Implements wibble::sys::ChildProcess.

References exec().


Member Data Documentation

std::vector<std::string> wibble::sys::Exec::args

Arguments for the process to execute.

args[0] will be passed as the name of the child process

Referenced by Exec(), exec(), and wibble::sys::ShellCommand::ShellCommand().

std::vector<std::string> wibble::sys::Exec::env

Custom environment for the child process, if envFromParent is false.

Referenced by exec(), and importEnv().

True if the environment is to be taken from the parent, false if it is explicitly provided in env.

Referenced by exec(), and wibble::sys::ShellCommand::ShellCommand().

Filename or pathname of the program to execute.

If searchInPath is true, this just needs to be the file name. Otherwise, it needs to be the absolute path of the file to execute.

Referenced by exec().

Set to true if the file is to be searched in the current $PATH.

If this is set to true, the environment will always be taken from the parent regardless of the values of envFromParent and env.

Referenced by exec(), and wibble::sys::ShellCommand::ShellCommand().


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