diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-08-23 14:51:15 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-08-23 14:54:05 +0900 |
commit | b0d1aa8340e1ffb0cecb119a80e368cfa2e724ef (patch) | |
tree | 8d31d49cc8632621a784505adb9321d85d73bc17 | |
parent | cd0775eb2cadf4c4050ec708fc5644c634731b17 (diff) | |
download | buildstream-b0d1aa8340e1ffb0cecb119a80e368cfa2e724ef.tar.gz |
_frontend/linuxapp.py: Fixing fallout from !693
When fixing terminal notifications, I had introduced a bug
with accesses to `os.environ` which triggered KeyError, this
patch fixes it.
-rw-r--r-- | buildstream/_frontend/linuxapp.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/buildstream/_frontend/linuxapp.py b/buildstream/_frontend/linuxapp.py index 667ce5c2b..0444dc7b4 100644 --- a/buildstream/_frontend/linuxapp.py +++ b/buildstream/_frontend/linuxapp.py @@ -28,9 +28,9 @@ from .app import App # def _osc_777_supported(): - term = os.environ['TERM'] + term = os.environ.get('TERM') - if term.startswith('xterm') or term.startswith('vte'): + if term and (term.startswith('xterm') or term.startswith('vte')): # Since vte version 4600, upstream silently ignores # the OSC 777 without printing garbage to the terminal. @@ -39,10 +39,10 @@ def _osc_777_supported(): # will trigger a desktop notification and bring attention # to the terminal. # - vte_version = os.environ['VTE_VERSION'] + vte_version = os.environ.get('VTE_VERSION') try: vte_version_int = int(vte_version) - except ValueError: + except (ValueError, TypeError): return False if vte_version_int >= 4600: |