From 868210a9fb35e1c41a3bc0f7bbc9081d33437f4d Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 30 May 2006 21:33:10 +0000 Subject: [PATCH] Fix stupidity in last check-in. --- src/utils/pintos | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/utils/pintos b/src/utils/pintos index 079ab5a..13d7e54 100755 --- a/src/utils/pintos +++ b/src/utils/pintos @@ -703,7 +703,7 @@ sub xsystem { my ($boots) = 0; local ($|) = 1; for (;;) { - if (waitpid ($pid, WNOHANG) == 0) { + if (waitpid ($pid, WNOHANG) != 0) { # Subprocess died. Pass through any remaining data. print $buf while sysread ($in, $buf, 4096) > 0; last; @@ -711,7 +711,8 @@ sub xsystem { # Read and print out pipe data. my ($len) = length ($buf); - last if sysread ($in, $buf, 4096, $len) <= 0; + waitpid ($pid, 0), last + if sysread ($in, $buf, 4096, $len) <= 0; print substr ($buf, $len); # Remove full lines from $buf and scan them for keywords. @@ -730,8 +731,9 @@ sub xsystem { } } } + } else { + waitpid ($pid, 0); } - waitpid ($pid, 0); alarm (0); &$cleanup (); -- 2.30.2