aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-07-27 15:46:47 -0700
committerZac Medico <zmedico@gentoo.org>2012-07-27 15:46:47 -0700
commit0c46edc9290a459f693c12fbb34a2f361e40e168 (patch)
treebbba24e89d8809174aeb8aed3a07cb4d2d8d0ba1
parentget_term_size: pass fd to stty (diff)
downloadportage-0c46edc9290a459f693c12fbb34a2f361e40e168.tar.gz
portage-0c46edc9290a459f693c12fbb34a2f361e40e168.tar.bz2
portage-0c46edc9290a459f693c12fbb34a2f361e40e168.zip
get_term_size: handle missing stty command
-rw-r--r--pym/portage/output.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/pym/portage/output.py b/pym/portage/output.py
index 5129db77e..e44375ee3 100644
--- a/pym/portage/output.py
+++ b/pym/portage/output.py
@@ -450,8 +450,15 @@ def get_term_size(fd=None):
except ImportError:
pass
- proc = subprocess.Popen(["stty", "size"],
- stdout=subprocess.PIPE, stderr=fd)
+ try:
+ proc = subprocess.Popen(["stty", "size"],
+ stdout=subprocess.PIPE, stderr=fd)
+ except EnvironmentError as e:
+ if e.errno != errno.ENOENT:
+ raise
+ # stty command not found
+ return (0, 0)
+
out = _unicode_decode(proc.communicate()[0])
if proc.wait() == os.EX_OK:
out = out.split()