def _run(self): debug.dprint( "STERMINAL: run_app(); process id = %d *******************" % os.getpid()) env = utils.environment() # next section probably not needed since this will usually be run one time only if self.reader.fd: if os.isatty(self.reader.fd): debug.dprint("STERMINAL: self.reader already has fd, closing") os.close(self.reader.fd) else: debug.dprint( "STERMINAL: self.reader has fd but seems to be already closed." ) try: os.close(self.reader.fd) except OSError as e: debug.dprint( "STERMINAL: error closing self.reader.fd: %s" % e) self.pid, self.reader.fd = pty.fork() if self.pid == pty.CHILD: # child try: # run the command shell = "/bin/sh" os.execve(shell, [shell, '-c', self.command], env) except Exception as e: debug.dprint("STERMINAL: Error in child" + e) os._exit(1) else: # set process_running so the reader thread reads it's output self.reader.process_running = True debug.dprint("STERMINAL: pty process id: %s ******" % self.pid) return
def _run(self): debug.dprint( "STERMINAL: run_app(); process id = %d *******************" % os.getpid()) env = utils.environment() # next section probably not needed since this will usually be run one time only if self.reader.fd: if os.isatty(self.reader.fd): debug.dprint("STERMINAL: self.reader already has fd, closing") os.close(self.reader.fd) else: debug.dprint( "STERMINAL: self.reader has fd but seems to be already closed." ) try: os.close(self.reader.fd) except OSError, e: debug.dprint( "STERMINAL: error closing self.reader.fd: %s" % e)
# boolean that causes the plugin gui to load the plugin's options widget HAS_OPTIONS = False if need_prefs: #global RUN_LOCAL from porthole import config debug.dprint(plugin_name + "config.Prefs.RUN_LOCAL= %s" %str(config.Prefs.RUN_LOCAL)) if config.Prefs.RUN_LOCAL: #global command import sys # make a destructable copy paths = environment()["PATH"].split(":") #debug.dprint(plugin_name + "paths = %s" %str(paths)) found_local = False while paths and not found_local: this_path = paths[0] paths.remove(this_path) #debug.dprint(plugin_name + "this_path = " + this_path) if "/home/" in this_path \ and "gpytage" in this_path \ and this_path.endswith("scripts"): found_local = True is_installed = True command = '"' + os.path.join(this_path, "gpytage") +'"' debug.dprint(plugin_name + " Found local version of Gpytage to run :)") debug.dprint(plugin_name + " local command: '%s' found = %s." %(command,is_installed)) elif 'site-packages' in this_path:
def __init__(self): CategoryHandler.__init__(self) self.get_sync_time() self.new_sync = False # create and start our process manager self.process_manager = ProcessManager(utils.environment(), False)
def open_log(self, widget): """ Open a log of a previous emerge in a new terminal window """ newterm = ProcessManager(utils.environment(), True) newterm.do_open(widget, None) return