def __init__(self, cmd, bufsize=1): strcmd = _get_str(cmd) self._p = os_popen._PopenCmd(strcmd, "w", bufsize, shared_eo=True) self._p.run() self.tochild = self._p.chinw self.fromchild = self._p.choutr self.childerr = None self.pid = self._p.worker.job_id
def __init__(self, cmd, capture_stderr=False, bufsize=0): strcmd = _get_str(cmd) self._p = os_popen._PopenCmd(strcmd, "w", bufsize, shared_eo=False) self._p.run() self.tochild = self._p.chinw self.fromchild = self._p.choutr if capture_stderr: self.childerr = self._p.cherrr else: self.childerr = None self.pid = self._p.worker.job_id
def popen2(cmd, bufsize=0, mode="t"): """Executes cmd as a sub-process. Returns the file objects (child_stdout, child_stdin).""" command = _get_str(cmd) i, o = os_popen.popen2(None, command, mode, bufsize) return o, i