Commit 2026ecce authored by Ben Pfaff's avatar Ben Pfaff
Browse files

pintos: Make sure to print buffered data at end of input.

Here, $buf might have some data in it that has not yet been printed, but
we were discarding it (and trying to read more) without printing it.

(In Perl, "do" ensures that the inner block runs at least once; without
"do" the condition is evaluated first.)
parent b9713669
......@@ -819,7 +819,7 @@ sub xsystem {
for (;;) {
if (waitpid ($pid, WNOHANG) != 0) {
# Subprocess died. Pass through any remaining data.
print $buf while sysread ($in, $buf, 4096) > 0;
do { print $buf } while sysread ($in, $buf, 4096) > 0;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment