mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Show Freddy the mirror
i.e. improve subprocess exit paths and exeception reporting
This commit is contained in:
parent
74e67661a6
commit
a2792bec1d
1 changed files with 15 additions and 7 deletions
|
@ -53,7 +53,7 @@ def main():
|
||||||
while 1:
|
while 1:
|
||||||
try:
|
try:
|
||||||
if exit_requested:
|
if exit_requested:
|
||||||
os._exit(0)
|
sys.exit(0)
|
||||||
try:
|
try:
|
||||||
seq, request = rpc.request_queue.get(0)
|
seq, request = rpc.request_queue.get(0)
|
||||||
except Queue.Empty:
|
except Queue.Empty:
|
||||||
|
@ -64,9 +64,15 @@ def main():
|
||||||
rpc.response_queue.put((seq, ret))
|
rpc.response_queue.put((seq, ret))
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
continue
|
continue
|
||||||
|
except SystemExit:
|
||||||
|
raise
|
||||||
except:
|
except:
|
||||||
|
try:
|
||||||
print_exception()
|
print_exception()
|
||||||
rpc.response_queue.put((seq, None))
|
rpc.response_queue.put((seq, None))
|
||||||
|
except:
|
||||||
|
traceback.print_exc(file=sys.__stderr__)
|
||||||
|
sys.exit(1.1)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
def manage_socket(address):
|
def manage_socket(address):
|
||||||
|
@ -207,13 +213,15 @@ class Executive:
|
||||||
try:
|
try:
|
||||||
exec code in self.locals
|
exec code in self.locals
|
||||||
except:
|
except:
|
||||||
try:
|
|
||||||
if exit_requested:
|
if exit_requested:
|
||||||
os._exit(0)
|
sys.exit(0)
|
||||||
|
try:
|
||||||
|
# even print a user code SystemExit exception, continue
|
||||||
print_exception()
|
print_exception()
|
||||||
except:
|
except:
|
||||||
sys.stderr = sys.__stderr__
|
# link not working?
|
||||||
raise
|
traceback.print_exc(file=sys.__stderr__)
|
||||||
|
sys.exit(1.2)
|
||||||
else:
|
else:
|
||||||
flush_stdout()
|
flush_stdout()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue