| Karim BELABAS on Tue, 10 Sep 2002 15:39:21 +0200 (MEST) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: stderr not consistently colored |
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 ]
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 ?
Karim.
Index: src/gp/gp.c
===================================================================
RCS file: /home/megrez/cvsroot/pari/src/gp/gp.c,v
retrieving revision 1.136
diff -c -r1.136 gp.c
*** src/gp/gp.c 2002/09/10 13:36:33 1.136
--- src/gp/gp.c 2002/09/10 13:37:42
***************
*** 2339,2345 ****
else
#endif
res = get_line_from_user(PROMPT, F);
! if (!disable_color) term_color(c_NONE);
}
else
res = get_line_from_file(DFT_PROMPT,F,infile);
--- 2339,2345 ----
else
#endif
res = get_line_from_user(PROMPT, F);
! if (!disable_color) { term_color(c_NONE); pariflush(); }
}
else
res = get_line_from_file(DFT_PROMPT,F,infile);
--
Karim Belabas Tel: (+33) (0)1 69 15 57 48
Dép. de Mathematiques, Bat. 425 Fax: (+33) (0)1 69 15 60 19
Université Paris-Sud Email: Karim.Belabas@math.u-psud.fr
F-91405 Orsay (France) http://www.math.u-psud.fr/~belabas/
--
PARI/GP Home Page: http://www.parigp-home.de/