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

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