Ensure that the update thread is stopped even after an error.
This commit is contained in:
parent
1626a8251b
commit
11a7062333
1 changed files with 10 additions and 8 deletions
2
vigil
2
vigil
|
|
@ -998,11 +998,13 @@ def main(root_path, worker_count=None, is_sandboxed=True, editor_command=None,
|
||||||
with _urwid_screen() as urwid_screen:
|
with _urwid_screen() as urwid_screen:
|
||||||
loop.add_reader(sys.stdin, on_input, urwid_screen)
|
loop.add_reader(sys.stdin, on_input, urwid_screen)
|
||||||
update_display_thread.start()
|
update_display_thread.start()
|
||||||
|
try:
|
||||||
signal.signal(signal.SIGWINCH, on_window_resize)
|
signal.signal(signal.SIGWINCH, on_window_resize)
|
||||||
with contextlib.suppress(KeyboardInterrupt):
|
with contextlib.suppress(KeyboardInterrupt):
|
||||||
loop.run_forever()
|
loop.run_forever()
|
||||||
log.log_command("Exiting...")
|
log.log_command("Exiting...")
|
||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
|
finally:
|
||||||
_UPDATE_THREAD_STOPPED = True
|
_UPDATE_THREAD_STOPPED = True
|
||||||
appearance_changed_event.set()
|
appearance_changed_event.set()
|
||||||
update_display_thread.join()
|
update_display_thread.join()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue