This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Unbuffer stdout and stderr on windows


On 08/16/2013 04:10 PM, Pedro Alves wrote:

>> A complete solution, if it exists, might require much more effort,
> 
> I don't think it does.
> 
> - First, make stderr always unbuffered.  That's what you get on
> most platforms anyway.
> - Then, somewhere along fputs_unfiltered or some central output routine,
> keep track of which was the last to be used between stdout and stderr.
> If outputting to stderr, flush stdout first.  Don't need to do the
> opposite, since stderr will always be unbuffered.

Or alternatively, like Tromey suggested, make fputs_unfiltered
or some such implement line buffering internally (for Windows hosts),
either by just forcing flushes at endlines (partial emulation), or
with real local buffering.  That potentially gets us a behavior
on Windows/pipes even closer to other platforms.  (His suggestion
was kind of sidetracked by the \n -> \r\n bit, but that's actually
a separate issue).

(Neither solution looks that complicated to me.)

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]