Make set_term_size() handle the CommandNotFound exception if stty
authorZac Medico <zmedico@gentoo.org>
Wed, 28 May 2008 01:13:40 +0000 (01:13 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 28 May 2008 01:13:40 +0000 (01:13 -0000)
is missing for some reason.

svn path=/main/trunk/; revision=10461

pym/portage/output.py

index e9a1a559a73c8233a41db6fed9217a4b0af92c8c..a7a500cd4f120efcf208cc8a87a85c79819c83a9 100644 (file)
@@ -13,7 +13,8 @@ import shlex
 import sys
 from portage.const import COLOR_MAP_FILE
 from portage.util import writemsg
-from portage.exception import PortageException, ParseError, PermissionDenied, FileNotFound
+from portage.exception import CommandNotFound, FileNotFound, \
+       ParseError, PermissionDenied, PortageException
 
 havecolor=1
 dotitles=1
@@ -405,7 +406,10 @@ def set_term_size(lines, columns, fd):
        """
        from portage.process import spawn
        cmd = ["stty", "rows", str(lines), "columns", str(columns)]
-       spawn(cmd, env=os.environ, fd_pipes={0:fd})
+       try:
+               spawn(cmd, env=os.environ, fd_pipes={0:fd})
+       except CommandNotFound:
+               writemsg("portage: stty: command not found\n", noiselevel=-1)
 
 class EOutput(object):
        """