diff options
author | Paul Tan <pyokagan@gmail.com> | 2015-08-04 22:08:49 +0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-08-12 10:33:46 -0700 |
commit | 18d8c26930acbba1627d2a8b7323be30ac2bd9bb (patch) | |
tree | 34999601b1c55a10394a901b70827e2c754e0c34 /mergetools/emerge | |
parent | git-am: add am.threeWay config variable (diff) | |
download | tgif-18d8c26930acbba1627d2a8b7323be30ac2bd9bb.tar.xz |
test_terminal: redirect child process' stdin to a pty
When resuming, git-am detects if we are trying to feed it patches or not
by checking if stdin is a TTY.
However, the test library redirects stdin to /dev/null. This makes it
difficult, for instance, to test the behavior of "git am -3" when
resuming, as git-am will think we are trying to feed it patches and
error out.
Support this use case by extending test-terminal.perl to create a
pseudo-tty for the child process' standard input as well.
Note that due to the way the code is structured, the child's stdin
pseudo-tty will be closed when we finish reading from our stdin. This
means that in the common case, where our stdin is attached to /dev/null,
the child's stdin pseudo-tty will be closed immediately. Some operations
like isatty(), which git-am uses, require the file descriptor to be
open, and hence if the success of the command depends on such functions,
test_terminal's stdin should be redirected to a source with large amount
of data to ensure that the child's stdin is not closed, e.g.
test_terminal git am --3way </dev/zero
Cc: Jonathan Nieder <jrnieder@gmail.com>
Cc: Jeff King <peff@peff.net>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'mergetools/emerge')
0 files changed, 0 insertions, 0 deletions