def deadly_signal(signum): info("got deadly signal %s, exiting\n" % SIGNAMES.get(signum, signum)) run_cleanups() # This works fine in tests, but for some reason if I use it here, then I # get bizarre behavior where the signal handler runs, and then I get a # KeyboardException (?!?), and the KeyboardException is handled normally # and exits the program (causing the cleanup handlers to be run again): #signal.signal(signum, signal.SIG_DFL) #kill(os.getpid(), signum) force_quit(128 + signum)
def signal_disconnect_and_quit(self, exit_code, reason): log("signal_disconnect_and_quit(%s, %s) exit_on_signal=%s", exit_code, reason, self.exit_on_signal) if not self.exit_on_signal: #if we get another signal, we'll try to exit without idle_add... self.exit_on_signal = True self.idle_add(self.disconnect_and_quit, exit_code, reason) self.idle_add(self.quit, exit_code) self.idle_add(self.exit) return #warning: this will run cleanup code from the signal handler self.disconnect_and_quit(exit_code, reason) self.quit(exit_code) self.exit() force_quit(exit_code)
def force_quit(): from xpra import os_util os_util.force_quit()
def handle_deadly_signal(self, signum, _frame=None): sys.stderr.write("\ngot deadly signal %s, exiting\n" % SIGNAMES.get(signum, signum)) sys.stderr.flush() self.cleanup() force_quit(128 + signum)
def force_quit(*args): log.debug("force_quit()") from xpra import os_util os_util.force_quit()
def do_quit(self, _proxy): force_quit(self._exit_code)