def run(options, args): exc = None try: wbui.main(False) # don't skip splash sys.exit(0) except Exception as e: exc = traceback.format_exc() if exc == None: return #print(exc, file=sys.stderr) with open(LOG_FILE, "a") as f: print(datetime.datetime.now().isoformat(), file=f) print(exc, file=f) uname = string_cli_unknown commit_id = string_cli_unknown try: uname = " ".join(os.uname()) if os.path.isfile(COMMITID_FILE): with open(COMMITID_FILE) as f: commit_id = f.read().strip() except: pass msg = io.BytesIO() print(exc.strip(), file=msg) print((u"uname=%s, wbui version=%s, commit id=%s\n" % (uname, system.version, commit_id)).encode("utf-8"), file=msg) print(string_cli_error.encode("utf-8"), file=msg) msg.write(string_cli_wbui_restart.encode("utf-8")) encoded_msg = base64.b64encode(msg.getvalue()) pygame.quit() if os.path.exists("/usr/bin/fbterm"): os.execv("/usr/bin/openvt", ("openvt", "-ws", "--", "/usr/bin/fbterm", "--", "wb", "show_message_and_wait", encoded_msg)) else: os.execv("/usr/sbin/wb", ("wb", "show_message_and_wait", encoded_msg))
def run(options, args): exc = None try: wbui.main(False) # don't skip splash sys.exit(0) except Exception as e: exc = traceback.format_exc() if exc == None: return # print(exc, file=sys.stderr) with open(LOG_FILE, "a") as f: print(datetime.datetime.now().isoformat(), file=f) print(exc, file=f) uname = string_cli_unknown commit_id = string_cli_unknown try: uname = " ".join(os.uname()) if os.path.isfile(COMMITID_FILE): with open(COMMITID_FILE) as f: commit_id = f.read().strip() except: pass msg = io.BytesIO() print(exc.strip(), file=msg) print((u"uname=%s, wbui version=%s, commit id=%s\n" % (uname, system.version, commit_id)).encode("utf-8"), file=msg) print(string_cli_error.encode("utf-8"), file=msg) msg.write(string_cli_wbui_restart.encode("utf-8")) encoded_msg = base64.b64encode(msg.getvalue()) pygame.quit() if os.path.exists("/usr/bin/fbterm"): os.execv( "/usr/bin/openvt", ("openvt", "-ws", "--", "/usr/bin/fbterm", "--", "wb", "show_message_and_wait", encoded_msg), ) else: os.execv("/usr/sbin/wb", ("wb", "show_message_and_wait", encoded_msg))
def run(options, args): wbui.main(True)