diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-12-13 13:38:54 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-12-13 13:38:54 +0100 |
| commit | 0e40b52a82efc95161c2dfb84f3c3737452336fb (patch) | |
| tree | 548ce3cff8ecf32cc3dfcc28ed0e85e13dcba915 /apt | |
| parent | 2a0259649b0656b9c262fea304ee8feb0c27ab1e (diff) | |
| parent | bebae32a598593f9d427d54cb48a84bd9beac227 (diff) | |
| download | python-apt-0e40b52a82efc95161c2dfb84f3c3737452336fb.tar.gz | |
merged from lp:~mvo/python-apt/mvo
Diffstat (limited to 'apt')
| -rw-r--r-- | apt/progress/text.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/apt/progress/text.py b/apt/progress/text.py index 95f18831..d777837c 100644 --- a/apt/progress/text.py +++ b/apt/progress/text.py @@ -15,6 +15,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA """Progress reporting for text interfaces.""" +import os import sys import apt_pkg @@ -107,12 +108,13 @@ class AcquireProgress(base.AcquireProgress, TextProgress): def _winch(self, *dummy): """Signal handler for window resize signals.""" - import fcntl - import termios - import struct - buf = fcntl.ioctl(self._file, termios.TIOCGWINSZ, 8 * ' ') - dummy, col, dummy, dummy = struct.unpack('hhhh', buf) - self._width = col - 1 # 1 for the cursor + if hasattr(self._file, "fileno") and os.isatty(self._file.fileno()): + import fcntl + import termios + import struct + buf = fcntl.ioctl(self._file, termios.TIOCGWINSZ, 8 * ' ') + dummy, col, dummy, dummy = struct.unpack('hhhh', buf) + self._width = col - 1 # 1 for the cursor def ims_hit(self, item): """Called when an item is update (e.g. not modified on the server).""" |
