38 cout <<
"antani" << endl;
49 int r = read(fd, &c, 1);
67 pid_t pid = child.
fork();
76 int res = child.
wait();
79 #pragma GCC diagnostic push
80 #pragma GCC diagnostic ignored "-Wold-style-cast"
83 #pragma GCC diagnostic pop
108 child.
args.push_back(
"antani");
145 write(in,
"hello\n", 6);
std::string suckFd(int fd)
Definition: childprocess.test.h:43
Definition: childprocess.test.h:23
int main()
Main function to be called in the child process after it has forked.
Definition: childprocess.test.h:25
Definition: childprocess.test.h:34
int main()
Main function to be called in the child process after it has forked.
Definition: childprocess.test.h:36
Base class for system exceptions.
Definition: exception.h:397
Fork a child process.
Definition: childprocess.h:43
pid_t fork()
For a subprocess to run proc.
int wait(struct rusage *ru=0)
Wait for the child to finish, returning its exit status and optionally storing resource usage informa...
Definition: childprocess.cpp:270
void kill(int signal)
Send the given signal to the process.
Definition: childprocess.cpp:310
pid_t forkAndRedirect(int *stdinfd=0, int *stdoutfd=0, int *stderrfd=0)
Definition: childprocess.h:107
Execute external commands, either forked as a ChildProcess or directly using exec().
Definition: exec.h:34
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
Execute a shell command using /bin/sh -c.
Definition: exec.h:98
Definition: buffer.cpp:28
void sleep(int secs)
Portable version of sleep.
Definition: thread.cpp:31
Definition: childprocess.test.h:59
Test shellCommand()
Definition: childprocess.test.h:122
Test redirect()
Definition: childprocess.test.h:105
Test kill()
Definition: childprocess.test.h:62
Test inout()
Definition: childprocess.test.h:137
Test output()
Definition: childprocess.test.h:88
void Test
Definition: test.h:178
#define assert_eq(x, y)
Definition: test.h:33
#define assert(x)
Definition: test.h:30