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

svn path=/main/branches/2.1.2/; revision=10464

pym/output.py

index ff4bb62cf82314e1ac798a3761e65d413475691a..c00ab00d4c7575cb9240796dc9cd809bdbcad52e 100644 (file)
@@ -7,7 +7,8 @@ __docformat__ = "epytext"
 import commands,errno,os,re,shlex,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
@@ -347,7 +348,10 @@ def set_term_size(lines, columns, fd):
        """
        from portage_exec 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:
        """