diff --git a/src/util.cpp b/src/util.cpp index f88f26f..e90392d 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -379,9 +379,16 @@ void Util::setFilePermissions(const boost::filesystem::path& path, const boost:: int Util::getTerminalWidth() { - struct winsize w; - ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); - return static_cast(w.ws_col); + int width; + if(isatty(STDOUT_FILENO)) + { + struct winsize w; + ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); + width = static_cast(w.ws_col); + } + else + width = 10000;//Something sufficiently big + return width; }