git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t9001: set TERM=dumb to prevent ANSI output

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 7, 2008, 05:23 UTC
Message-ID
<7v7igf5cpk.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<200803070541.15793.chriscool@tuxfamily.org>
Christian Couder <chriscool@tuxfamily.org> writes:
Show 38 quoted lines
> Le vendredi 7 mars 2008, Junio C Hamano a écrit :
>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>> > At least on one of my machines, Term::ReadLine tries to be clever and
>> > sends \x1b\x5b1034h at the end of the script when TERM is set to
>> > 'xterm'.
>> >
>> > To prevent that, force TERM=dumb just for the test.
>>
>> We try to set up a pretty vanilla environment for test repeatability in
>> t/test-lib.sh, and I suspect we would simply want to do this over there.
>>
>> Wouldn't this make more sense?
>>
>> diff --git a/t/test-lib.sh b/t/test-lib.sh
>> index 87a5ea4..7f6331a 100644
>> --- a/t/test-lib.sh
>> +++ b/t/test-lib.sh
>> @@ -7,8 +7,9 @@
>>  LANG=C
>>  LC_ALL=C
>>  PAGER=cat
>> +TERM=dumb
>>  TZ=UTC
>> -export LANG LC_ALL PAGER TZ
>> +export LANG LC_ALL PAGER TERM TZ
>>  EDITOR=:
>>  VISUAL=:
>>  unset GIT_EDITOR
>
> This may not work well with colored output.
> In test-lib.sh line 62 there is :
>
> [ "x$TERM" != "xdumb" ] &&
> 	[ -t 1 ] &&
> 	tput bold >/dev/null 2>&1 &&
> 	tput setaf 1 >/dev/null 2>&1 &&
> 	tput sgr0 >/dev/null 2>&1 &&
> 	color=t
Ahh.  Sorry about that.
 t/test-lib.sh |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index c0c5e21..8a8b33e 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -3,12 +3,23 @@
 # Copyright (c) 2005 Junio C Hamano
 #
 
+# Grab if the true terminal is capable of color before resetting
+# TERM to dumb for repeatability
+
+[ "x$TERM" != "xdumb" ] &&
+	[ -t 1 ] &&
+	tput bold >/dev/null 2>&1 &&
+	tput setaf 1 >/dev/null 2>&1 &&
+	tput sgr0 >/dev/null 2>&1 &&
+	color=t
+
 # For repeatability, reset the environment to known value.
 LANG=C
 LC_ALL=C
 PAGER=cat
 TZ=UTC
-export LANG LC_ALL PAGER TZ
+TERM=dumb
+export LANG LC_ALL PAGER TERM TZ
 EDITOR=:
 VISUAL=:
 unset GIT_EDITOR
@@ -59,13 +70,6 @@ esac
 # '
 # . ./test-lib.sh
 
-[ "x$TERM" != "xdumb" ] &&
-	[ -t 1 ] &&
-	tput bold >/dev/null 2>&1 &&
-	tput setaf 1 >/dev/null 2>&1 &&
-	tput sgr0 >/dev/null 2>&1 &&
-	color=t
Previous: Christian CouderNext: Junio C Hamano
Message 5 of 9 in “t9001: set TERM=dumb to prevent ANSI output”
  1. t9001: set TERM=dumb to prevent ANSI outputJohannes Schindelin, Mar 6, 2008
  2. Junio C HamanoMar 6, 2008
  3. Johannes SchindelinMar 7, 2008
  4. Christian CouderMar 7, 2008
  5. Junio C HamanoMar 7, 2008
  6. Junio C HamanoMar 7, 2008
  7. Johannes SchindelinMar 7, 2008
  8. Junio C HamanoMar 7, 2008
  9. Johannes SchindelinMar 7, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.