On Sun, Oct 17, 2010 at 02:37:00AM +0800, Tay Ray Chuan wrote:
The outcome depends on whether stdout was already a terminal (in which
case test_terminal is a noop) or not (in which case test_terminal
introduces a pseudo-tty in the middle of the pipeline).
$ test_terminal.perl sh -c 'test -t 1 && echo >&2 YES' >out
YES
$ sh -c 'test -t 1 && echo >&2 YES' >out
$
How about this?
- use the test_terminal script even when running with "-v"
if IO::Pty is available, to allow commands like
test_terminal foo >out 2>err
- add a separate TTYREDIR prerequisite which is only set
when the test_terminal script is usable
Is it even worth keeping the direct-to-tty code at all? Yes, it means
that people without IO::Pty can use _some_ terminal tests with "-v". But
it creates a headache for test writers in understanding the subtle
difference between TTY and TTYREDIR.
-Peff