]> granicus.if.org Git - clang/commitdiff
If stderr isn't a terminal, don't try to guess the terminal width or
authorDaniel Dunbar <daniel@zuster.org>
Wed, 6 May 2009 21:28:42 +0000 (21:28 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 6 May 2009 21:28:42 +0000 (21:28 +0000)
look at COLUMNS.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71120 91177308-0d34-0410-b5e6-96231b3b80d8

test/TestRunner.sh
tools/clang-cc/clang-cc.cpp

index 48b48d5a29ca44d85c9ba996ab319ccd30b2d860..bb20728578c1caca44d2ad1db4afd69ff92f8c2f 100755 (executable)
@@ -18,9 +18,6 @@ TESTNAME=$1
 SUBST=$1
 FILEDIR=`dirname $TESTNAME`
 
-# Make diagnostic printing more determinstic.
-export COLUMNS=0
-
 OUTPUT=Output/$1.out
 
 # create the output directory if it does not already exist
index 3282c193de43fa1802508635f8296c2663018de6..f71be5d5ea6a351c42ddf1d5fab3ada880676dcc 100644 (file)
@@ -1895,6 +1895,10 @@ InputFilenames(llvm::cl::Positional, llvm::cl::desc("<input files>"));
 /// \returns the width of the terminal (in characters), if there is a
 /// terminal. If there is no terminal, returns 0.
 static unsigned getTerminalWidth() {
+  // Is this a terminal? If not, don't wrap by default.
+  if (!llvm::sys::Process::StandardErrIsDisplayed())
+    return 0;
+
   // If COLUMNS is defined in the environment, wrap to that many columns.
   if (const char *ColumnsStr = std::getenv("COLUMNS")) {
     int Columns = atoi(ColumnsStr);
@@ -1902,10 +1906,6 @@ static unsigned getTerminalWidth() {
       return Columns;
   }
 
-  // Is this a terminal? If not, don't wrap by default.
-  if (!llvm::sys::Process::StandardErrIsDisplayed())
-    return 0;
-
 #if HAVE_SYS_TYPES_H
   // Try to determine the width of the terminal.
   struct winsize ws;