formula: set TERM to dumb during test

Software that tries to print different things (e.g. ANSI color) based on
different termcaps often relies on the TERM environment variable, and
could fail without it. This results in confusing test issues where
certain tests can be successfully run by users testing locally with TERM
set, but choke up on our CI.

Always setting TERM to dumb leads to better consistency between local
tests and CI tests, and saves much probing in certain cases.
This commit is contained in:
Zhiming Wang 2016-09-17 03:01:47 -04:00
parent a54c96825b
commit f8d7745547
No known key found for this signature in database
GPG Key ID: BBD31D4D110044B8

View File

@ -1434,8 +1434,10 @@ class Formula
old_tmpdir = ENV["TMPDIR"] old_tmpdir = ENV["TMPDIR"]
old_temp = ENV["TEMP"] old_temp = ENV["TEMP"]
old_tmp = ENV["TMP"] old_tmp = ENV["TMP"]
old_term = ENV["TERM"]
ENV["CURL_HOME"] = old_curl_home || old_home ENV["CURL_HOME"] = old_curl_home || old_home
ENV["TMPDIR"] = ENV["TEMP"] = ENV["TMP"] = HOMEBREW_TEMP ENV["TMPDIR"] = ENV["TEMP"] = ENV["TMP"] = HOMEBREW_TEMP
ENV["TERM"] = "dumb"
mktemp("#{name}-test") do |staging| mktemp("#{name}-test") do |staging|
staging.retain! if ARGV.keep_tmp? staging.retain! if ARGV.keep_tmp?
@testpath = staging.tmpdir @testpath = staging.tmpdir
@ -1457,6 +1459,7 @@ class Formula
ENV["TMPDIR"] = old_tmpdir ENV["TMPDIR"] = old_tmpdir
ENV["TEMP"] = old_temp ENV["TEMP"] = old_temp
ENV["TMP"] = old_tmp ENV["TMP"] = old_tmp
ENV["TERM"] = old_term
end end
# @private # @private