diff --git a/playbook/templates/client.py b/playbook/templates/client.py index 2abeed6..a4458dc 100755 --- a/playbook/templates/client.py +++ b/playbook/templates/client.py @@ -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()