Skip to content

Commit

Permalink
Merge branch 'mn/sideband-no-ansi'
Browse files Browse the repository at this point in the history
Tools that read diagnostic output in our standard error stream do
not want to see terminal control sequence (e.g. erase-to-eol).
Detect them by checking if the standard error stream is connected to
a tty.

* mn/sideband-no-ansi:
  sideband.c: do not use ANSI control sequence on non-terminal
  • Loading branch information
Junio C Hamano committed Jun 9, 2014
2 parents d37e8c5 + 38de156 commit 251cb96
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sideband.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 251cb96

Please sign in to comment.