[fpc-devel] Output flush on pipes

Daniël Mantione daniel.mantione at freepascal.org
Sun May 14 16:19:07 CEST 2006



Op Sun, 14 May 2006, schreef Michael Van Canneyt:

> On Sun, 14 May 2006, Martin Schreiber wrote:
> 
> > Suggestion:
> > On win32 switch automatic output writeln flush only off by regular files 
> > (FILE_TYPE_DISK) but not by pipes (FILE_TYPE_PIPE):
> > 
> > rtl/win32/sysfile.inc
> > 
> > function do_isdevice(handle:thandle):boolean;
> > begin
> >   do_isdevice:=(getfiletype(handle)=2);
> > end;
> > 
> > change to:
> > 
> > function do_isdevice(handle:thandle):boolean;
> > var
> >   wo1: dword;
> > begin
> >   wo1:= getfiletype(handle);
> >   do_isdevice:= (wo1 = FILE_TYPE_CHAR) or (wo1 = FILE_TYPE_PIPE);
> > end;
> 
> I would at least make it
> 
>    do_isdevice:=(getfiletype(handle)<>FILE_TYPE_DISK);
> 
> so it includes 'unknown' file types and future file types.

I am starting to come to the conclusion that this is not the right 
approach. Of course such a fix is Windows specific, while pipes are used 
on Unix as well, imagine using less to paginate the compiler output.

Doing it on all platforms would help, but even a file is often used 
interactively, for example with "tail -f". Therefore, it seems much more 
logical to make the compiler flush after each message.

Daniël


More information about the fpc-devel mailing list