def _do_open_terminal(self, term): ready = self.wait_for_data([self.sock], 0.1) if self.sock not in ready: # XXX TODO: wait for a keypress from some existing terminal # to trigger the appearance of the terminal. # Specify options via the environment. # This allows us to spawn the joiner with no arguments, # so it will work with the "-e" option of terminal programs. env = {} env["PIAS_OPT_JOIN"] = "1" env["PIAS_OPT_COMMAND"] = "replay" env["PIAS_OPT_DATAFILE"] = self.eventlog.datafile env["PIAS_OPT_TERMINAL"] = self.terminal cmd = self.terminal or get_default_terminal() forkexec([cmd, "-e", get_pias_script()], env) view_sock, _ = self.sock.accept() if self.live_replay: # this is cribbed from recorder._handle_open_terminal # TODO (JC): look into further refactoring common code into an util function # Fork a new shell behind a pty. _, proc_fd = forkexec_pty([self.replay_shell]) # often the terminal comes up before the pty has had a chance to send: ready = None while not ready: ready = self.wait_for_data([proc_fd], 0.1) else: proc_fd = None self.terminals[term] = (view_sock, proc_fd) self.proc_fds[proc_fd] = term
def _do_open_terminal(self, term): ready = self.wait_for_data([self.sock], 0.1) if self.sock not in ready: # XXX TODO: wait for a keypress from some existing terminal # to trigger the appearance of the terminal. # Specify options via the environment. # This allows us to spawn the joiner with no arguments, # so it will work with the "-e" option of terminal programs. env = {} env["PIAS_OPT_JOIN"] = "1" env["PIAS_OPT_COMMAND"] = "replay" env["PIAS_OPT_DATAFILE"] = self.eventlog.datafile env["PIAS_OPT_TERMINAL"] = self.terminal forkexec([self.terminal, "-e", get_pias_script()], env) view_sock, _ = self.sock.accept() if self.live_replay: # this is cribbed from recorder._handle_open_terminal # TODO (JC): look into further refactoring common code into an util function # Fork a new shell behind a pty. _, proc_fd = forkexec_pty([self.replay_shell]) # often the terminal comes up before the pty has had a chance to send: ready = None while not ready: ready = self.wait_for_data([proc_fd], 0.1) else: proc_fd = None self.terminals[term] = (view_sock, proc_fd) self.proc_fds[proc_fd] = term
def _do_open_terminal(self, term): ready = self.wait_for_data([self.sock], 0.1) if self.sock not in ready: # XXX TODO: wait for a keypress from some existing terminal # to trigger the appearance of the terminal. join_cmd = list(sys.argv) join_cmd.insert(1, "--join") forkexec(self.terminal, "-x", *join_cmd) view_sock, _ = self.sock.accept() self.terminals[term] = (view_sock,)
def _do_open_terminal(self, term): ready = self.wait_for_data([self.sock], 0.1) if self.sock not in ready: # XXX TODO: wait for a keypress from some existing terminal # to trigger the appearance of the terminal. # Specify options via the environment. # This allows us to spawn the joiner with no arguments, # so it will work with the "-e" option of terminal programs. env = {} env["PIAS_OPT_JOIN"] = "1" env["PIAS_OPT_COMMAND"] = "replay" env["PIAS_OPT_DATAFILE"] = self.eventlog.datafile env["PIAS_OPT_TERMINAL"] = self.terminal forkexec([self.terminal, "-e", get_pias_script()], env) view_sock, _ = self.sock.accept() self.terminals[term] = (view_sock,)