client.py: Always restart on errors if on kiosk mode except on graceful exit

master
Felix Stupp 4 years ago
parent 8efecc27c3
commit 8554d27cc7
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -51,7 +51,15 @@ def select_ui(win, args):
pass
if args.kiosk:
subprocess.call(['systemctl', 'poweroff'])
return True # exited as expected
def retry(fun):
last_return = False
while not last_return:
try:
last_return = fun()
except:
pass # TODO save log file with error
def main():
parser = argparse.ArgumentParser(add_help=False)
@ -66,7 +74,12 @@ def main():
parts = [part.replace('_', ' ') for part in parts]
print(str(' - '.join(parts)))
return
curses.wrapper(select_ui, args)
def run():
curses.wrapper(select_ui, args)
if args.kiosk:
retry(run)
else:
run()
if __name__ == '__main__':
main()

Loading…
Cancel
Save