Subject: Re: [PATCH 1/3] test-terminal: give the child an empty stdin TTY

From: Thomas Rast <[email-masked]>
Date: Mon, 12 Dec 2011 19:34:40 +0100

Jonathan Nieder wrote:
> Hi,
> 
> Thomas Rast wrote:
> > -# Run @$argv in the background with stdio redirected to $out and $err.
> > +# Run @$argv in the background with stdio redirected from $in and to $out and $err.
> 
> I'm not thrilled about this change.  The original purpose of
> test_terminal was to test commands like "git log" that need to check
> whether stdout is a tty in order to decide whether to use color and to
> paginate their output.  Perhaps whether stdin is a tty _should_ affect
> those decisions, but it currently doesn't (for example, "echo HEAD |
> git log --stdin" works) and that would deserve a separate test, I'd
> think.
> 
> The testsuite bug you mentioned sounds like a real one and worth
> fixing, though.  Maybe there would be some way for test_terminal to
> give the caller some control over which file descriptors to replace
> with a terminal.

I'm not sure I understand what you are arguing for or why.  That I
avoid wasting a Pty, and only replace stdin with /dev/null?

(Because with the current state of the tests, this shouldn't make much
of a difference.  I just figured I should go all the way and give
commands an environment that really looks like they'd been called from
the terminal.)

-- 
Thomas Rast
trast@{inf,student}.ethz.ch