[Top][All Lists]

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

Re: Lost process output in pipe between Emacs and CVS

From: Richard Stallman
Subject: Re: Lost process output in pipe between Emacs and CVS
Date: Sun, 21 Jul 2002 14:15:34 -0600 (MDT)

      If a buffer flush fails with EAGAIN during
    printf, what should happen?

printf should retry, perhaps after a short sleep, and thus more or
less emulate the behavior with an ordinary blocking descriptor.

      If printf returns an error
    indication, it can't indicate how many bytes it wrote into the buffer.

That is true, but returning an error indication is the wrong thing to
do anyway.  The user doesn't want printf to fail because of some mere
temporary difficulty.

    In the case of a large printf(), it might already have flushed the
    buffer once, so it is not possible in general for printf() to remove
    the characters it added to the buffer.

To remove them would be wrong even if it could.

    The only reasonable answer is to not use printf() with a non-blocking
    buffer.  But then why not apply that logic to stdio in general?  Just
    don't use stdio with non-blocking buffers.

That is perfectly consistent but not at all helpful.  The helpful
thing to do is to make it work in a way that is convenient.

If all stdio output functions handle EAGAIN by sleeping for a short time
and trying again, most user programs will be happy with the results.
The few that are not happy are those that should not use stdio.

reply via email to

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