Public Types | |
enum | { NO_WAIT = 0, WAIT = 1, CONNECT_STDOUT = 2, CONNECT_STDERR = 4, CONNECT_STDOUT_AND_ERR = 8 } |
Static Public Member Functions | |
static pid_t | execAsync (const char *file, const char *const arguments[]) throw (YGP::ExecError) |
static void | execute (const char *file, const char *const arguments[]) throw (YGP::ExecError) |
static pid_t | execIOConnected (const char *file, const char *const arguments[], int *fd, unsigned int flags=CONNECT_STDOUT_AND_ERR) throw (YGP::ExecError) |
static pid_t | getPID () |
static int | waitForProcess (pid_t pid) |
Static Protected Member Functions | |
static pid_t | start (const char *file, const char *const arguments[], int flags, int *fd=NULL) throw (YGP::ExecError) |
The program is supposed to return 0, if it succeeds and any other value if it encounters an error. In case of an error it should display its error on stdout or stderr. This output is captured and thrown as exception for the caller.
In case of an asynchron running program it must display its error in (more or less) the first second of its execution (as the controlling process only waits one second before checking for program termination).
static pid_t YGP::Process::execAsync | ( | const char * | file, | |
const char *const | arguments[] | |||
) | throw (YGP::ExecError) [inline, static] |
Executes a program asynchronously to the execution of the current process.
If either the file can not be found or produces an error while initializing (in the more or less 1st second) an describing text (at least if the program produces an helpful output) is thrown.
file | Name of file to execute | |
arguments | Array with arguments for the file (as understood by execv) |
file
is a valid ASCIIZ-string YGP::ExecError | An error-message displayed by the program |
static pid_t YGP::Process::execIOConnected | ( | const char * | file, | |
const char *const | arguments[], | |||
int * | fd, | |||
unsigned int | flags = CONNECT_STDOUT_AND_ERR | |||
) | throw (YGP::ExecError) [inline, static] |
Executes a program in the background.
If either the file can not be found or produces an error while initializing (in the more or less 1st second) an describing text (at least if the program produces an helpful output) is thrown.
file | Name of file to execute | |
arguments | Array with arguments for the file (as understood by execv) | |
fd | Pipes for communication | |
flags | Flags describing how to connect stdin/stdout |
file
is a valid ASCIIZ-string YGP::ExecError | An error-message displayed by the program |
static void YGP::Process::execute | ( | const char * | file, | |
const char *const | arguments[] | |||
) | throw (YGP::ExecError) [inline, static] |
Executes a program.
The execution of the calling process is suspended, til the new program has terminated. If either the file can not be found or produces an error while executing an describing text (at least if the program produces an helpful output) is thrown.
file | Name of file to execute | |
arguments | Array with arguments for the file (as understood by execv) |
file
is a valid ASCIIZ-string YGP::ExecError | An error-message displayed by the program |
static pid_t YGP::Process::getPID | ( | ) | [inline, static] |
pid_t YGP::Process::start | ( | const char * | file, | |
const char *const | arguments[], | |||
int | flags, | |||
int * | fd = NULL | |||
) | throw (YGP::ExecError) [static, protected] |
Executes a program, either in the back- or foreground.
If either the file can not be found or produces an error while executing/initializing (in the more or less 1st second) an describing text (at least if the program produces an helpful output) is thrown.
file | Name of file to execute | |
arguments | Array with arguments for the file (as understood by execv) | |
flags | Flags; e.g. if to wait til the program terminates | |
fd | Filedescriptors for communication with the child.
|
file
is a valid ASCIIZ-string YGP::ExecError | An error-message displayed by the program |
int YGP::Process::waitForProcess | ( | pid_t | pid | ) | [static] |
Wait til process has terminated.
pid | Proess to wait for |