diff options
author | David Emett <dave@sp4m.net> | 2015-09-20 13:22:26 (GMT) |
---|---|---|
committer | David Emett <dave@sp4m.net> | 2018-09-29 18:23:13 (GMT) |
commit | f56a83284495a2998e68797390d277ca94089aa2 (patch) | |
tree | 0e3e05564a48cc3422207c6dcce5f828f2d1b2f6 | |
parent | ca041d88f4d610332aa48c801342edfafb622ccb (diff) | |
download | Ninja-f56a83284495a2998e68797390d277ca94089aa2.zip Ninja-f56a83284495a2998e68797390d277ca94089aa2.tar.gz Ninja-f56a83284495a2998e68797390d277ca94089aa2.tar.bz2 |
Query terminal width from STDOUT_FILENO
Rather than 0 (stdin). So it will work even if ninja's stdin isn't connected to
the terminal for whatever reason.
-rw-r--r-- | src/line_printer.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/line_printer.cc b/src/line_printer.cc index 2cd3e17..6bf9e1b 100644 --- a/src/line_printer.cc +++ b/src/line_printer.cc @@ -82,7 +82,7 @@ void LinePrinter::Print(string to_print, LineType type) { // Limit output to width of the terminal if provided so we don't cause // line-wrapping. winsize size; - if ((ioctl(0, TIOCGWINSZ, &size) == 0) && size.ws_col) { + if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, &size) == 0) && size.ws_col) { to_print = ElideMiddle(to_print, size.ws_col); } printf("%s", to_print.c_str()); |