summaryrefslogtreecommitdiff
path: root/sideband.c
diff options
context:
space:
mode:
authorMichael Naumov <mnaoumov@gmail.com>2014-05-28 03:12:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-06-02 18:02:27 (GMT)
commit38de156a05a4421103e93d43b36e9967e63fb707 (patch)
tree13c244694a81b89572e75de36a6dadc001d7738f /sideband.c
parent4a28f169ad29ba452e0e7bea2583914c10c58322 (diff)
downloadgit-38de156a05a4421103e93d43b36e9967e63fb707.zip
git-38de156a05a4421103e93d43b36e9967e63fb707.tar.gz
git-38de156a05a4421103e93d43b36e9967e63fb707.tar.bz2
sideband.c: do not use ANSI control sequence on non-terminal
Diagnostic messages received on the sideband #2 from the server side are sent to the standard error with ANSI terminal control sequence "\033[K" that erases to the end of line appended at the end of each line. However, some programs (e.g. GitExtensions for Windows) read and interpret and/or show the message without understanding the terminal control sequences, resulting them to be shown to their end users. To help these programs, squelch the control sequence when the standard error stream is not being sent to a tty. NOTE: I considered to cover the case that a pager has already been started. But decided that is probably not worth worrying about here, though, as we shouldn't be using a pager for commands that do network communications (and if we do, omitting the magic line-clearing signal is probably a sane thing to do). Thanks-to: Erik Faye-Lund <kusmabite@gmail.com> Thanks-to: Jeff King <peff@peff.net> Signed-off-by: Michael Naumov <mnaoumov@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sideband.c')
-rw-r--r--sideband.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sideband.c b/sideband.c
index d1125f5..7f9dc22 100644
--- a/sideband.c
+++ b/sideband.c
@@ -30,7 +30,7 @@ int recv_sideband(const char *me, int in_stream, int out)
memcpy(buf, PREFIX, pf);
term = getenv("TERM");
- if (term && strcmp(term, "dumb"))
+ if (isatty(2) && term && strcmp(term, "dumb"))
suffix = ANSI_SUFFIX;
else
suffix = DUMB_SUFFIX;