Go to the documentation of this file. 1 #ifndef WIBBLE_SYS_EXEC_H
2 #define WIBBLE_SYS_EXEC_H
59 std::vector<std::string>
args;
64 std::vector<std::string>
env;
107 args.push_back(
"-c");
virtual int main()
Used to run the program as a child process, if one of the ChildProcess::fork functions is called.
Definition: exec.cpp:33
void importEnv()
Import the current environment into env.
Definition: exec.cpp:43
Execute a shell command using /bin/sh -c.
Definition: exec.h:97
virtual void spawnChild()
On Windows, it's impossible to fork(), but if you were to fork+exec, it's not all lost.
Definition: exec.cpp:49
virtual ~Exec()
Definition: exec.h:44
std::vector< std::string > env
Custom environment for the child process, if envFromParent is false.
Definition: exec.h:64
void exec()
exec the program, never returning if all goes well
Definition: exec.cpp:60
Exec(const std::string &pathname)
Create a new object that will execute program ‘program’.
Definition: exec.h:81
Fork a child process.
Definition: childprocess.h:42
bool envFromParent
True if the environment is to be taken from the parent, false if it is explicitly provided in env.
Definition: exec.h:70
Base class for system exceptions.
Definition: exception.h:396
std::string pathname
Filename or pathname of the program to execute.
Definition: exec.h:52
std::vector< std::string > args
Arguments for the process to execute.
Definition: exec.h:59
ShellCommand(const std::string &cmd)
Definition: exec.h:100
Execute external commands, either forked as a ChildProcess or directly using exec().
Definition: exec.h:33
bool searchInPath
Set to true if the file is to be searched in the current $PATH.
Definition: exec.h:78
Exception thrown when some consistency check fails.
Definition: exception.h:254