Fix logging throws if event loop is set but not running

This commit is contained in:
Aaron Heise 2023-02-11 11:26:37 -06:00
parent c7c75d5ea4
commit f80823344b

View File

@ -122,9 +122,12 @@ def _rns_log(msg, level=3, _override_destination=False):
if tattr_orig is not None:
termios.tcsetattr(sys.stdin.fileno(), termios.TCSANOW, tattr_orig)
if _loop:
_loop.call_soon_threadsafe(inner)
else:
try:
if _loop:
_loop.call_soon_threadsafe(inner)
else:
inner()
except RuntimeError:
inner()