about summary refs log tree commit diff
path: root/src/nix/progress-bar.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-08-25T13·57+0200
committerEelco Dolstra <edolstra@gmail.com>2017-08-25T13·59+0200
commitdb1d45037cf923bf470a8581d5546bef8247c756 (patch)
tree4537c9cde61ef5d7680b869518dad8b64878aa1d /src/nix/progress-bar.cc
parentec9e0c03c398ca48fba81fd6e870dc396da01b08 (diff)
Handle SIGWINCH
Diffstat (limited to 'src/nix/progress-bar.cc')
-rw-r--r--src/nix/progress-bar.cc9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/nix/progress-bar.cc b/src/nix/progress-bar.cc
index cd5a8fca26ee..2ad0994508fe 100644
--- a/src/nix/progress-bar.cc
+++ b/src/nix/progress-bar.cc
@@ -6,8 +6,6 @@
 #include <map>
 #include <atomic>
 
-#include <sys/ioctl.h>
-
 namespace nix {
 
 static std::string getS(const std::vector<Logger::Field> & fields, size_t n)
@@ -99,15 +97,10 @@ private:
 
     Sync<State> state_;
 
-    int width = 0;
-
 public:
 
     ProgressBar()
     {
-        struct winsize ws;
-        if (ioctl(1, TIOCGWINSZ, &ws) == 0)
-            width = ws.ws_col;
     }
 
     ~ProgressBar()
@@ -270,7 +263,7 @@ public:
             }
         }
 
-        writeToStderr("\r" + ansiTruncate(line, width) + "\e[K");
+        writeToStderr("\r" + ansiTruncate(line, getWindowSize().second) + "\e[K");
     }
 
     std::string getStatus(State & state)