about summary refs log tree commit diff
path: root/src/nix/progress-bar.cc
diff options
context:
space:
mode:
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)