Skip to content

Commit 487f866

Browse files
committed
attempt to handle exit signal cleanly
1 parent 4626f7b commit 487f866

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

vpython/no_notebook.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ def stop_server():
334334
"""Shuts down all threads and exits cleanly."""
335335
global __server
336336
__server.shutdown()
337+
337338
event_loop = txaio.config.loop
338339
event_loop.stop()
339340
# We've told the event loop to stop, but it won't shut down until we poke
@@ -354,11 +355,11 @@ def stop_server():
354355
if threading.main_thread().is_alive():
355356
sys.exit(0)
356357
else:
357-
pass
358358
# If the main thread has already stopped, the python interpreter
359359
# is likely just running .join on the two remaining threads (in
360360
# python/threading.py:_shutdown). Since we just stopped those threads,
361361
# we'll now exit.
362+
sys.exit(0) # but just in case....
362363

363364

364365
GW = GlowWidget()

vpython/vpython.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@
1616
from ._vector_import_helper import (vector, mag, norm, cross, dot, adjust_up,
1717
adjust_axis, object_rotate)
1818

19-
def Exit():
20-
zero = 0.
21-
print('exit')
22-
a = 1.0/zero
23-
24-
import atexit
25-
atexit.register(Exit)
26-
2719
# List of names that will be imported from this file with import *
2820
__all__ = ['Camera', 'GlowWidget', 'version', 'GSversion', 'Mouse', 'arrow', 'attach_arrow',
2921
'attach_light', 'attach_trail', 'baseObj', 'box', 'bumpmaps', 'button',

0 commit comments

Comments
 (0)