X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Futils%2Fpintos;h=13d7e5436fbe77a79d18ac1d81b02083214fa8de;hb=b8632191cf88da4debca435c1ac834ba17428b01;hp=b18693b776f6bf1679ded0b590f1c690c9500114;hpb=c1589ebc0b6ea34d608af61bad80979abbaeb9fc;p=pintos-anon diff --git a/src/utils/pintos b/src/utils/pintos index b18693b..13d7e54 100755 --- a/src/utils/pintos +++ b/src/utils/pintos @@ -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