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");
Fork a child process.
Definition: childprocess.h:43
Execute external commands, either forked as a ChildProcess or directly using exec().
Definition: exec.h:34
std::vector< std::string > env
Custom environment for the child process, if envFromParent is false.
Definition: exec.h:64
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
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
std::string pathname
Filename or pathname of the program to execute.
Definition: exec.h:52
virtual ~Exec()
Definition: exec.h:44
void exec()
exec the program, never returning if all goes well
Definition: exec.cpp:60
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
bool searchInPath
Set to true if the file is to be searched in the current $PATH.
Definition: exec.h:78
std::vector< std::string > args
Arguments for the process to execute.
Definition: exec.h:59
void importEnv()
Import the current environment into env.
Definition: exec.cpp:43
Exec(const std::string &pathname)
Create a new object that will execute program ‘program’.
Definition: exec.h:81
Execute a shell command using /bin/sh -c.
Definition: exec.h:98
ShellCommand(const std::string &cmd)
Definition: exec.h:100