def __session_child_watch_handler(self, pid, status): if not os.WIFEXITED(status): exit_code = util.EXIT_CODE_FATAL if os.WIFSIGNALED(status): signal_num = os.WTERMSIG(status) mprint("sabayon-session exited with SIGNAL %s", signal_num) else: mprint("sabayon-session exited for an unknown reason") else: exit_code = os.WEXITSTATUS(status) # Here we cannot throw an exception for the error cases, # since we are a callback running out of the Glib main # loop. So we have to set a flag and let the code # *outside* the main loop pick it up. if exit_code == util.EXIT_CODE_NORMAL: mprint("sabayon-session exited normally") success = True elif exit_code == util.EXIT_CODE_RECOVERABLE: errors.errors_log_recoverable_error( debuglog.DEBUG_LOG_DOMAIN_ADMIN_TOOL, "sabayon-session exited with RECOVERABLE exit status" ) # FIXME: throw a warning dialog else: errors.errors_log_fatal_error( debuglog.DEBUG_LOG_DOMAIN_ADMIN_TOOL, "sabayon-session exited with a FATAL ERROR (exit code %s)" % exit_code, ) gtk.main_quit() # so that the toplevel 'sabayon' will exit the main loop and show the fatal error protosession.clobber_user_processes(self.username) protosession.reset_shell_and_homedir(self.username, self.temp_homedir) self.temp_homedir = None if self.temp_xauth_path: os.remove(self.temp_xauth_path) self.temp_xauth_path = None self.__copy_from_user(self.user_profile_path, self.profile_path) self.user_profile_path = None self.session_pid = 0 self.session_child_watch = 0 # gobject.source_remove (self.session_stderr_watch_id) # self.session_stderr_watch_id = 0 # self.session_stderr.close () # self.session_stderr = None self.emit("finished") return False
def __del__(self): if self.temp_homedir: protosession.reset_shell_and_homedir(self.username, self.temp_homedir) self.temp_homedir = None if self.user_profile_path: os.remove(self.user_profile_path) self.user_profile_path = None if self.temp_xauth_path: os.remove(self.temp_xauth_path) self.temp_xauth_path = None