Fix stupidity in last check-in.
[pintos-anon] / src / utils / pintos
index b18693b776f6bf1679ded0b590f1c690c9500114..13d7e5436fbe77a79d18ac1d81b02083214fa8de 100755 (executable)
@@ -702,7 +702,13 @@ sub xsystem {
            my ($buf) = "";
            my ($boots) = 0;
            local ($|) = 1;
-           while (waitpid ($pid, WNOHANG) == 0) {
+           for (;;) {
+               if (waitpid ($pid, WNOHANG) != 0) {
+                   # Subprocess died.  Pass through any remaining data.
+                   print $buf while sysread ($in, $buf, 4096) > 0;
+                   last;
+               }
+
                # Read and print out pipe data.
                my ($len) = length ($buf);
                waitpid ($pid, 0), last