Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 87123af

Browse files
committed
Fix ExceptHook bug on Mac - except msg sometimes not printed
1 parent 314e574 commit 87123af

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/helpers.pyx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ def ExceptHook(exc_type, exc_value, exc_trace):
1919
and exit application immediately by ignoring "finally" (_exit()).
2020
"""
2121
print("[CEF Python] ExceptHook: catched exception, will shutdown CEF")
22-
QuitMessageLoop()
23-
Shutdown()
2422
msg = "".join(traceback.format_exception(exc_type, exc_value,
2523
exc_trace))
2624
error_file = GetAppPath("error.log")
@@ -40,6 +38,11 @@ def ExceptHook(exc_type, exc_value, exc_trace):
4038
msg = msg.encode("ascii", errors="replace")
4139
msg = msg.decode("ascii", errors="replace")
4240
print("\n"+msg)
41+
# There is a strange bug on Mac. Sometimes except message is not
42+
# printed if QuitMessageLoop and Shutdown were called before the print
43+
# message above.
44+
QuitMessageLoop()
45+
Shutdown()
4346
# noinspection PyProtectedMember
4447
os._exit(1)
4548

0 commit comments

Comments
 (0)