From: Ben Pfaff Date: Tue, 30 May 2006 19:25:32 +0000 (+0000) Subject: Make stdout unbuffered while filtering output. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c1589ebc0b6ea34d608af61bad80979abbaeb9fc;p=pintos-anon Make stdout unbuffered while filtering output. --- diff --git a/src/utils/pintos b/src/utils/pintos index 856ebfa..b18693b 100755 --- a/src/utils/pintos +++ b/src/utils/pintos @@ -701,12 +701,13 @@ sub xsystem { # Filter output. my ($buf) = ""; my ($boots) = 0; + local ($|) = 1; while (waitpid ($pid, WNOHANG) == 0) { # Read and print out pipe data. my ($len) = length ($buf); waitpid ($pid, 0), last if sysread ($in, $buf, 4096, $len) <= 0; - print STDOUT substr ($buf, $len); + print substr ($buf, $len); # Remove full lines from $buf and scan them for keywords. while ((my $idx = index ($buf, "\n")) >= 0) {