Python popen2.Popen4() Examples

The following are 7 code examples of popen2.Popen4(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module popen2 , or try the search function .
Example #1
Source File: textext.py    From inkscapeMadeEasy with GNU General Public License v3.0 5 votes vote down vote up
def exec_command(cmd, ok_return_value=0, combine_error=False):
        """
        Run given command, check return value, and return
        concatenated stdout and stderr.
        """
        
        # XXX: unix-only!

        try:
            p = popen2.Popen4(cmd, True)
            p.tochild.close()
            returncode = p.wait() >> 8
            out = p.fromchild.read()
        except OSError, e:
            raise RuntimeError("Command %s failed: %s" % (' '.join(cmd), e)) 
Example #2
Source File: TestCmd.py    From gyp with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, command, **kw):
                if kw.get('stderr') == 'STDOUT':
                    popen2.Popen4.__init__(self, command, 1)
                else:
                    popen2.Popen3.__init__(self, command, 1)
                self.stdin = self.tochild
                self.stdout = self.fromchild
                self.stderr = self.childerr 
Example #3
Source File: TestCmd.py    From gyp with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, command, **kw):
                if kw.get('stderr') == 'STDOUT':
                    popen2.Popen4.__init__(self, command, 1)
                else:
                    popen2.Popen3.__init__(self, command, 1)
                self.stdin = self.tochild
                self.stdout = self.fromchild
                self.stderr = self.childerr 
Example #4
Source File: TestCmd.py    From kawalpemilu2014 with GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self, command, **kw):
                if kw.get('stderr') == 'STDOUT':
                    apply(popen2.Popen4.__init__, (self, command, 1))
                else:
                    apply(popen2.Popen3.__init__, (self, command, 1))
                self.stdin = self.tochild
                self.stdout = self.fromchild
                self.stderr = self.childerr 
Example #5
Source File: TestCmd.py    From android-xmrig-miner with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, command, **kw):
                if kw.get('stderr') == 'STDOUT':
                    apply(popen2.Popen4.__init__, (self, command, 1))
                else:
                    apply(popen2.Popen3.__init__, (self, command, 1))
                self.stdin = self.tochild
                self.stdout = self.fromchild
                self.stderr = self.childerr 
Example #6
Source File: CheetahWrapper.py    From moviegrabber with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, cmd, bufsize=-1, shell=True, close_fds=True,
                        stdin=PIPE, stdout=PIPE, stderr=STDOUT, **kwargs):

            super(Popen4, self).__init__(cmd, bufsize=bufsize, shell=shell,
                            close_fds=close_fds, stdin=stdin, stdout=stdout,
                            stderr=stderr, **kwargs)

            self.tochild = self.stdin
            self.fromchild = self.stdout
            self.childerr = self.stderr 
Example #7
Source File: CheetahWrapper.py    From moviegrabber with GNU General Public License v3.0 5 votes vote down vote up
def assertPosixSubprocess(self, cmd):
        cmd = cmd.replace('cheetah', self.cmd)
        process = Popen4(cmd, env=os.environ)
        process.tochild.close()
        output = process.fromchild.read()
        status = process.wait()
        process.fromchild.close()
        return status, output