46 int devin, devout, deverr;
47 int prev_stdin, prev_stdout, prev_stderr;
49 if (command_line.empty())
56 devout = dup(STDOUT_FILENO);
60 devout = open(outpath.c_str(), O_CREAT|O_WRONLY|O_APPEND, 00666);
63 prev_stdout = dup(STDOUT_FILENO);
64 dup2(devout, STDOUT_FILENO);
69 devin = open(
"/dev/null", O_RDWR);
73 devin = open(inpath.c_str(), O_RDONLY, 00666);
75 prev_stdin = dup(STDIN_FILENO);
76 dup2(devin, STDIN_FILENO);
79 prev_stderr = dup(STDERR_FILENO);
86 deverr = open(errpath.c_str(), O_CREAT|O_WRONLY|O_APPEND, 00666);
88 dup2(deverr, STDERR_FILENO);
92 iretn = system(command_line.c_str());
95 dup2(prev_stdin, STDIN_FILENO);
96 dup2(prev_stdout, STDOUT_FILENO);
97 dup2(prev_stderr, STDERR_FILENO);
int iretn
Definition: rw_test.cpp:37
#define GENERAL_ERROR_EMPTY
Definition: cosmos-errno.h:288