From 858fe7e89760c65ade651005ce87271c5ef138b2 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Mon, 24 Aug 2015 00:40:52 +0000 Subject: [PATCH] prevent closing sys.stdin or sys.stdout --- lib/damask/asciitable.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/damask/asciitable.py b/lib/damask/asciitable.py index 30623d680..bda44890f 100644 --- a/lib/damask/asciitable.py +++ b/lib/damask/asciitable.py @@ -77,7 +77,7 @@ class ASCIItable(): # ------------------------------------------------------------------ def input_close(self): try: - self.__IO__['in'].close() + if self.__IO__['in'] != sys.stdin: self.__IO__['in'].close() except: pass @@ -115,7 +115,7 @@ class ASCIItable(): def output_close(self, dismiss = False): try: - self.__IO__['out'].close() + if self.__IO__['out'] != sys.stdout: self.__IO__['out'].close() except: pass if dismiss and os.path.isfile(self.__IO__['out'].name): os.remove(self.__IO__['out'].name)