Skip to content

Commit

Permalink
More robust wait for exit condition during .serve() (#1939)
Browse files Browse the repository at this point in the history
* More robust wait for exit condition during .serve()

* lint
  • Loading branch information
jleibs authored and teh-cmc committed Apr 20, 2023
1 parent 1af5080 commit b0d986a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions rerun_py/rerun_sdk/rerun/script_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ def script_teardown(args: Namespace) -> None:
"""
if args.serve:
import signal
from threading import Event
import time

exit = Event()
signal.signal(signal.SIGINT, lambda sig, frame: exit.set())
print("Sleeping while serving the web viewer. Abort with Ctrl-C")
exit.wait()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
print("Ctrl-C received. Exiting.")

0 comments on commit b0d986a

Please sign in to comment.