Skip to content

Commit

Permalink
Fix ExceptHook bug on Mac - except msg sometimes not printed
Browse files Browse the repository at this point in the history
  • Loading branch information
cztomczak committed Jun 16, 2017
1 parent 314e574 commit 87123af
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/helpers.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ def ExceptHook(exc_type, exc_value, exc_trace):
and exit application immediately by ignoring "finally" (_exit()).
"""
print("[CEF Python] ExceptHook: catched exception, will shutdown CEF")
QuitMessageLoop()
Shutdown()
msg = "".join(traceback.format_exception(exc_type, exc_value,
exc_trace))
error_file = GetAppPath("error.log")
Expand All @@ -40,6 +38,11 @@ def ExceptHook(exc_type, exc_value, exc_trace):
msg = msg.encode("ascii", errors="replace")
msg = msg.decode("ascii", errors="replace")
print("\n"+msg)
# There is a strange bug on Mac. Sometimes except message is not
# printed if QuitMessageLoop and Shutdown were called before the print
# message above.
QuitMessageLoop()
Shutdown()
# noinspection PyProtectedMember
os._exit(1)

Expand Down

0 comments on commit 87123af

Please sign in to comment.