Ensure tmux panes are closed atexit for hw-diags

This commit is contained in:
2Shirt 2019-11-10 17:38:03 -07:00
parent 76a501af85
commit 964885d63c
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 9 additions and 9 deletions

View file

@ -5,15 +5,9 @@
import wk
def main():
"""Run hardware diagnostics."""
state = wk.hw.diags.State()
wk.hw.diags.main()
if __name__ == '__main__':
try:
main()
wk.hw.diags.main()
except SystemExit:
raise
except: #pylint: disable=bare-except

View file

@ -1,6 +1,7 @@
"""WizardKit: Hardware diagnostics"""
# vim: sts=2 sw=2 ts=2
import atexit
import logging
import pathlib
import platform
@ -14,6 +15,9 @@ from wk.cfg.hw import TMUX_SIDE_WIDTH
from wk.cfg.main import KIT_NAME_FULL
# atexit functions
atexit.register(tmux.kill_all_panes)
# STATIC VARIABLES
DOCSTRING = f'''{KIT_NAME_FULL}: Hardware Diagnostics
@ -102,7 +106,7 @@ class State():
behind=True,
lines=2,
vertical=True,
text=self.top_text,
text=f'{self.top_text}\nMain Menu',
)
# Started
@ -225,7 +229,6 @@ def main():
# Show menu
while True:
state.update_top_pane('Main Menu')
action = None
selection = menu.advanced_select()
@ -257,6 +260,9 @@ def main():
#run_diags()
pass
# Reset top pane
state.update_top_pane('Main Menu')
def network_test():
"""Run network tests."""