guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patch for duplicated output


From: Ken Raeburn
Subject: patch for duplicated output
Date: Tue, 13 Oct 2009 11:57:11 -0400

The duplicated output that Greg and I (at least) have seen in the output of "make check" is, I suspect, related to not flushing buffers before forking. At least in my tests, the bug only showed up when piping output through "more"; Greg's email (http://www.mail-archive.com/address@hidden/msg04139.html ) doesn't say whether he was sending output directly to a terminal, a file, or a pipe.

It appears to me that Guile is buffering the default output and error ports if they're not connected to terminal devices, so writing the output to a file or piping through more enables buffering and can produce the problem. The patch below has fixed it for me in my testing so far. Okay to commit?

Thanks to Andy for suggesting in IRC what the problem might be....

Ken

Author: Ken Raeburn <address@hidden>
Date:   Tue Oct 13 11:45:34 2009 -0400

    Flush output before forking.

diff --git a/test-suite/tests/socket.test b/test-suite/tests/socket.test
index 718fb94..8fccc36 100644
--- a/test-suite/tests/socket.test
+++ b/test-suite/tests/socket.test
@@ -277,6 +277,8 @@
                (set! server-listening? #t)
                #t)))

+       (force-output (current-output-port))
+       (force-output (current-error-port))
        (if server-listening?
            (let ((pid (primitive-fork)))
              ;; Spawn a server process.
@@ -365,6 +367,8 @@
                (set! server-listening? #t)
                #t)))

+       (force-output (current-output-port))
+       (force-output (current-error-port))
        (if server-listening?
            (let ((pid (primitive-fork)))
              ;; Spawn a server process.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]