Bill Allombert on Tue, 10 Sep 2002 21:14:02 +0200


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

Re: stderr not consistently colored


On Tue, Sep 10, 2002 at 03:39:21PM +0200, Karim BELABAS wrote:
> On Tue, 10 Sep 2002, Bill Allombert wrote:
> > ? \g4
> > ? default(colors,"1, 5, 3, 5, 6, 2, 3")
> >    colors = "1, 5, 3, 5, 6, 2, 3"
> > ? factor(2^64+1,0)
> [...]
> > IFAC is not consistently colored.
> 
> Nice. On Solaris, I see nothing [ my Linux box is down, can't check ]

Try 
gp 2>&1 | tee gp-err
and check the escape code.

> >From the code, it's a buffering issue, with a kind of race condition between
> stdout and stderr: the terminal reset code is written to stdout, but factor()
> starts writing to stderr (possibly) before stdout is flushed.
> 
> So I can
> 
> 1) either reset stderr also [ a bit stupid since it shouldn't have been
> altered during the input loop (the error recovery code would restore it) ]
> 
> 2) or flush stdout after the input loop.
> 
> I've chosen 2). Can you try the following patch ?

This seems to work perfectly.

Thanks!

Bill.
PS: Is there a way to change stderr color inside GP?