Show Freddy the mirror

i.e. improve subprocess exit paths and exeception reporting
This commit is contained in:
Kurt B. Kaiser 2003-05-17 21:04:10 +00:00
parent 74e67661a6
commit a2792bec1d
1 changed files with 15 additions and 7 deletions

View File

@ -53,7 +53,7 @@ def main():
while 1:
try:
if exit_requested:
os._exit(0)
sys.exit(0)
try:
seq, request = rpc.request_queue.get(0)
except Queue.Empty:
@ -64,9 +64,15 @@ def main():
rpc.response_queue.put((seq, ret))
except KeyboardInterrupt:
continue
except SystemExit:
raise
except:
print_exception()
rpc.response_queue.put((seq, None))
try:
print_exception()
rpc.response_queue.put((seq, None))
except:
traceback.print_exc(file=sys.__stderr__)
sys.exit(1.1)
continue
def manage_socket(address):
@ -207,13 +213,15 @@ class Executive:
try:
exec code in self.locals
except:
if exit_requested:
sys.exit(0)
try:
if exit_requested:
os._exit(0)
# even print a user code SystemExit exception, continue
print_exception()
except:
sys.stderr = sys.__stderr__
raise
# link not working?
traceback.print_exc(file=sys.__stderr__)
sys.exit(1.2)
else:
flush_stdout()