From: Jeff King Date: Mon, 12 Dec 2011 19:16:02 GMT Subject: Re: [PATCH 1/3] test-terminal: give the child an empty stdin TTY Message-ID: <20111212191602.GA14061@sigill.intra.peff.net> In-Reply-To: <7vfwgp4niu.fsf@alter.siamese.dyndns.org> On Mon, Dec 12, 2011 at 11:07:21AM -0800, Junio C Hamano wrote: > > Because of the latter, t7006.58ff cause unexpected results if you do: > > > > git rev-list | > > while read sha; do > > git checkout sha > > make test > > done > > In the above, lack of dollar-sign in "git checkout $sha" is obvious ;-) > but I think it is a bug that you are not running make with its stdin > redirected from /dev/null in the first place. > > Perhaps "make test" should do that for all tests, not just this terminal > related one? Doing it this way we do not have to worry about other tests > reading from the standard input by mistake. That was my thought, as well. We want the test environment to be as sterile and predictable as possible, so connecting stdin to /dev/null seems like a sensible thing. > diff --git a/Makefile b/Makefile > index ed82320..7a85237 100644 > --- a/Makefile > +++ b/Makefile > @@ -2239,7 +2239,7 @@ export NO_SVN_TESTS > ### Testing rules > > test: all > - $(MAKE) -C t/ all > + $(MAKE) -C t/ all /dev/null 3>/dev/null fi +exec 6<&0 +exec 0