Blame SOURCES/0001-Handle-if-TERM-is-not-set.patch

e66971
From daa66bc6acd2430cdd05e9883dd1eab69b698252 Mon Sep 17 00:00:00 2001
e66971
From: Andy Grover <agrover@redhat.com>
e66971
Date: Tue, 23 May 2017 12:00:10 -0700
e66971
Subject: [PATCH] Handle if TERM is not set
e66971
e66971
Previous patch causes problems otherwise in some cases.
e66971
e66971
Signed-off-by: Andy Grover <agrover@redhat.com>
e66971
---
e66971
 configshell/shell.py | 5 +++--
e66971
 1 file changed, 3 insertions(+), 2 deletions(-)
e66971
e66971
diff --git a/configshell/shell.py b/configshell/shell.py
e66971
index c916366..e029c76 100644
e66971
--- a/configshell/shell.py
e66971
+++ b/configshell/shell.py
e66971
@@ -50,13 +50,14 @@ else:
e66971
     tty=False
e66971
     
e66971
     # remember the original setting
e66971
-    oldTerm = os.environ['TERM']
e66971
+    oldTerm = os.environ.get('TERM')
e66971
     os.environ['TERM'] = ''
e66971
 
e66971
     import readline
e66971
 
e66971
     # restore the orignal TERM setting
e66971
-    os.environ['TERM'] = oldTerm
e66971
+    if oldTerm != None:
e66971
+        os.environ['TERM'] = oldTerm
e66971
     del oldTerm
e66971
     
e66971
 # Pyparsing helper to group the location of a token and its value