|
|
@ -9,6 +9,9 @@ |
|
|
|
@license LGPL, see file <a href="license.html">COPYING</a> |
|
|
|
@license LGPL, see file <a href="license.html">COPYING</a> |
|
|
|
|
|
|
|
|
|
|
|
$Log$ |
|
|
|
$Log$ |
|
|
|
|
|
|
|
Revision 1.10 2005/03/14 16:26:34 marc |
|
|
|
|
|
|
|
bugs have been fixed a long time ago, now no more in buglist |
|
|
|
|
|
|
|
|
|
|
|
Revision 1.9 2004/12/20 07:40:35 marc |
|
|
|
Revision 1.9 2004/12/20 07:40:35 marc |
|
|
|
documentation improved, new grouping |
|
|
|
documentation improved, new grouping |
|
|
|
|
|
|
|
|
|
|
@ -151,11 +154,11 @@ mrw::Exec& mrw::Exec::execute(bool exc) throw(std::exception) { |
|
|
|
ssize_t num1(1), num2(1); |
|
|
|
ssize_t num1(1), num2(1); |
|
|
|
char buf[4096]; |
|
|
|
char buf[4096]; |
|
|
|
int res(0), s(0); |
|
|
|
int res(0), s(0); |
|
|
|
/** @bug @b Solved: It sometimes did not get the whole input
|
|
|
|
/* It sometimes did not get the whole input since I changed to non
|
|
|
|
since I changed to non blocking pipes. Now I have found |
|
|
|
blocking pipes. Now I have found the solution to the problems: |
|
|
|
the solution to the problems: Non blocking IO does not |
|
|
|
Non blocking IO does not work in conjunction with select!
|
|
|
|
work in conjunction with @c select! Also the pipe must |
|
|
|
Also the pipe must not be nonblocking on both ends, but only on |
|
|
|
not be nonblocking on both ends, but only on one. */ |
|
|
|
one. */ |
|
|
|
while (num1||num2||!res) try { // not end of files or child terminated
|
|
|
|
while (num1||num2||!res) try { // not end of files or child terminated
|
|
|
|
if (!res && (res=waitpid(pid, &s, WNOHANG))) |
|
|
|
if (!res && (res=waitpid(pid, &s, WNOHANG))) |
|
|
|
if (res!=pid || WIFEXITED(s)!=0 && WEXITSTATUS(s)!=0) |
|
|
|
if (res!=pid || WIFEXITED(s)!=0 && WEXITSTATUS(s)!=0) |
|
|
@ -217,11 +220,11 @@ mrw::Exec& mrw::Exec::execute(const std::string& input, bool exc) |
|
|
|
std::string in(input); |
|
|
|
std::string in(input); |
|
|
|
char buf[4096]; |
|
|
|
char buf[4096]; |
|
|
|
int res(0), s(0); |
|
|
|
int res(0), s(0); |
|
|
|
/** @bug @b Solved: It sometimes did not get the whole input
|
|
|
|
/* It sometimes did not get the whole input since I changed to non
|
|
|
|
since I changed to non blocking pipes. Now I have found |
|
|
|
blocking pipes. Now I have found the solution to the problems: |
|
|
|
the solution to the problems: Non blocking IO does not |
|
|
|
Non blocking IO does not work in conjunction with select! Also |
|
|
|
work in conjunction with @c select! Also the pipe must |
|
|
|
the pipe must not be nonblocking on both ends, but only on |
|
|
|
not be nonblocking on both ends, but only on one. */ |
|
|
|
one. */ |
|
|
|
while (num0||num1||num2||!res) try { // not end of files or child terminated
|
|
|
|
while (num0||num1||num2||!res) try { // not end of files or child terminated
|
|
|
|
if (!res && (res=waitpid(pid, &s, WNOHANG))) |
|
|
|
if (!res && (res=waitpid(pid, &s, WNOHANG))) |
|
|
|
if (res!=pid || WIFEXITED(s)!=0 && WEXITSTATUS(s)!=0) |
|
|
|
if (res!=pid || WIFEXITED(s)!=0 && WEXITSTATUS(s)!=0) |
|
|
|