Skip to content

Commit

Permalink
Add error checking to get_terminal_size.
Browse files Browse the repository at this point in the history
Adds returncode error checking to get_terminal_size so that
it doesn't spew errors to console when running glance commands
in a shell without a TTY.

Fixes LP Bug #956202.

Change-Id: I42e155d168da1f4f25c0dea9ad9768686bd654ce
  • Loading branch information
dprince committed Mar 15, 2012
1 parent 223ed06 commit 0a19061
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion glance/common/utils.py
Expand Up @@ -326,7 +326,9 @@ def _get_terminal_size_posix():
p = subprocess.Popen(['stty', 'size'],
shell=False,
stdout=subprocess.PIPE)
return tuple(int(x) for x in p.communicate()[0].split())
result = p.communicate()
if p.returncode == 0:
return tuple(int(x) for x in result[0].split())
except:
pass

Expand Down

0 comments on commit 0a19061

Please sign in to comment.