From 8f1aeb7da8719165b01d19657222d33681cf77e2 Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Mon, 7 Oct 2019 16:43:10 +0200 Subject: [PATCH] starting new branch for issue #8; [FIX] removing handling of non-handled exception from switchTo() --- wexpect.py | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/wexpect.py b/wexpect.py index c48e810..ee4967d 100644 --- a/wexpect.py +++ b/wexpect.py @@ -2064,22 +2064,13 @@ class Wtty: win32console.AttachConsole(self.conpid) self.__consin = win32console.GetStdHandle(win32console.STD_INPUT_HANDLE) self.__consout = self.getConsoleOut() - except Exception as e: - #e = traceback.format_exc() - try: - win32console.AttachConsole(self.__parentPid) - except Exception as ex: - pass - #log(e) - #log(ex) - return - #self.__consin = None - #self.__consout = None - #raise e - - - - + except: + # In case of any error: We "switch back" (attach) our original console, then raise the + # error. + win32console.AttachConsole(self.__parentPid) + raise + + def switchBack(self): """Releases from the current console and attaches to the parents."""