From f56a83284495a2998e68797390d277ca94089aa2 Mon Sep 17 00:00:00 2001 From: David Emett Date: Sun, 20 Sep 2015 14:22:26 +0100 Subject: 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. --- src/line_printer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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()); -- cgit v0.12