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:51:15 +0900 |
commit | a53b7e2193fa6b6fc7ea738fe1eb6599e3edfc5e (patch) | |
tree | 5b1af1a8df06bb53ad9534fe73b4c78cea803ea4 | |
parent | be8cb8aeef7068ff1084a1f3b0442286d1b16a56 (diff) | |
download | buildstream-a53b7e2193fa6b6fc7ea738fe1eb6599e3edfc5e.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: |