From 9ac783d723bda15a34218ebb2037b60e521c3248 Mon Sep 17 00:00:00 2001 From: "Kurt B. Kaiser" Date: Mon, 10 Mar 2003 20:42:24 +0000 Subject: [PATCH] M PyShell.py M rpc.py Improve exception handing if peer process has terminated. --- Lib/idlelib/PyShell.py | 5 ++++- Lib/idlelib/rpc.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index 946e0b28c15..0c9fbfbcfac 100644 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -400,7 +400,10 @@ def __signal_interrupt(self): from signal import SIGINT except ImportError: SIGINT = 2 - os.kill(self.rpcpid, SIGINT) + try: + os.kill(self.rpcpid, SIGINT) + except OSError: # subprocess may have already exited + pass def __request_interrupt(self): self.rpcclt.asynccall("exec", "interrupt_the_server", (), {}) diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py index 54455a26020..2939f5fa83b 100644 --- a/Lib/idlelib/rpc.py +++ b/Lib/idlelib/rpc.py @@ -166,6 +166,8 @@ def localcall(self, request): return ("OK", ret) except SystemExit: raise + except socket.error: + pass except: self.debug("localcall:EXCEPTION") traceback.print_exc(file=sys.__stderr__)