libite
|
#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
Functions | |
int | runbg (char *const cmd[], int delay) |
Run command in the background. More... | |
int runbg | ( | char *const | cmd[], |
int | delay | ||
) |
Run command in the background.
cmd | NULL terminated list of command and optional arguments |
delay | Microseconds after fork() to wait before calling cmd |
This function forks to run the given command cmd
in the background. To ensure there are no lingering zombies the function actuall forks twice, and also calls setsid(), before it calls usleep() with the delay
argument. The command cmd
is handed over to execvp().
Since it runs in the background it is not possible to get the return code of the command.