Index: runtime/bin/stdio_macos.cc |
diff --git a/runtime/bin/stdio_macos.cc b/runtime/bin/stdio_macos.cc |
index 4b27a1b56bc71201b76d9b29591d9d6067a40887..79e34f89cee5d37c183f8b468c4ebcd88d67d775 100644 |
--- a/runtime/bin/stdio_macos.cc |
+++ b/runtime/bin/stdio_macos.cc |
@@ -67,12 +67,13 @@ void Stdin::SetLineMode(bool enabled) { |
bool Stdout::GetTerminalSize(int size[2]) { |
struct winsize w; |
if (TEMP_FAILURE_RETRY_BLOCK_SIGNALS( |
- ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != 0)) { |
- return false; |
+ ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) == 0) && |
+ (w.ws_col != 0 || w.ws_row != 0)) { |
+ size[0] = w.ws_col; |
+ size[1] = w.ws_row; |
+ return true; |
} |
- size[0] = w.ws_col; |
- size[1] = w.ws_row; |
- return true; |
+ return false; |
} |
} // namespace bin |