Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [RFH] Flush progress message buffer in display().

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:52

Nicolas Pitre [off-list ref] writes:
On Mon, 19 Nov 2007, Junio C Hamano wrote:
quoted
The standard error stream is not "fully buffered":

    http://www.opengroup.org/onlinepubs/000095399/functions/xsh_chap02_05.html#tag_02_05

Not "fully buffered" means either "unbuffered" or "line
buffered".  Because the progress display does not terminate its
line, it means that the additional fflush(stderr) you added are
needed if the stream is line buffered (still conforming).
Maybe stdio on Linux considers \r as a line termination.
Or totally unbufferred.  Running strace on this:

        #include <stdio.h>

        int
        main(int ac, char **av)
        {
                fprintf(stderr, "foo");
                fprintf(stderr, "bar");
                return 0;
        }

will tell you.  I bet you will see two write(2) of 3 bytes
each.
Flushing stderr should not hurt anyway.
True, especially if the rate is limited, which it is.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help