libutil: read window size from stdout if stderr fails
This fixes the output of `nix help 2>/dev/null` so it stops wrapping at 60 columns. Change-Id: Id0000000842b5befd73afbd6aff2825bdeae46af
This commit is contained in:
@@ -106,7 +106,7 @@ static Sync<std::pair<unsigned short, unsigned short>> windowSize{{0, 0}};
|
||||
void updateWindowSize()
|
||||
{
|
||||
struct winsize ws;
|
||||
if (ioctl(2, TIOCGWINSZ, &ws) == 0) {
|
||||
if (ioctl(2, TIOCGWINSZ, &ws) == 0 || ioctl(1, TIOCGWINSZ, &ws) == 0) {
|
||||
auto windowSize_(windowSize.lock());
|
||||
windowSize_->first = ws.ws_row;
|
||||
windowSize_->second = ws.ws_col;
|
||||
|
||||
Reference in New Issue
Block a user