From c1589ebc0b6ea34d608af61bad80979abbaeb9fc Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 30 May 2006 19:25:32 +0000 Subject: [PATCH] Make stdout unbuffered while filtering output. --- src/utils/pintos | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) { -- 2.30.2