aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp/blaze_util_platform.h
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2017-07-07 23:06:07 +0200
committerGravatar László Csomor <laszlocsomor@google.com>2017-07-10 09:16:52 +0200
commit458990b0c155130e242117e2bfc5ebfdf787d2e2 (patch)
treeaedf2eca9a95afcf30812dd5d7108765adf85afd /src/main/cpp/blaze_util_platform.h
parenta9f7687e6d4b8ef58766c6c1c85e38ed0993cd4a (diff)
Look at stderr for terminal detection.
bazel prints all the progress to stderr, yet the decision to switch between "smart" and "dumb" output modes is done based on the stdout and stderr connected terminals. That breaks for a command like this: bazel query 'something' | wc -l Even though all the progress is still output to the terminal through stderr, bazel switches to "dumb" mode, printing progress messages one per line. It seems reasonable to make the "smart"/"dumb" output mode decision based on the stderr only. Tested: With the change "bazel query '...' | wc -l" prints "smart" progress messages. RELNOTES: Check stderr to detect if connected to a terminal. Deprecate --isatty. PiperOrigin-RevId: 161243017
Diffstat (limited to 'src/main/cpp/blaze_util_platform.h')
-rw-r--r--src/main/cpp/blaze_util_platform.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/cpp/blaze_util_platform.h b/src/main/cpp/blaze_util_platform.h
index b553518b36..4faa171169 100644
--- a/src/main/cpp/blaze_util_platform.h
+++ b/src/main/cpp/blaze_util_platform.h
@@ -203,12 +203,13 @@ std::string GetUserName();
// Returns true iff the current terminal is running inside an Emacs.
bool IsEmacsTerminal();
-// Returns true iff the current terminal can support color and cursor movement.
-bool IsStandardTerminal();
+// Returns true if stderr is connected to a terminal that can support color
+// and cursor movement.
+bool IsStderrStandardTerminal();
-// Returns the number of columns of the terminal to which stdout is
+// Returns the number of columns of the terminal to which stderr is
// connected, or 80 if there is no such terminal.
-int GetTerminalColumns();
+int GetStderrTerminalColumns();
} // namespace blaze