root/packaging/centuryegg/fake_subprocess.py

Revision 8844, 0.8 KB (checked in by davidm, 2 years ago)

Remove silly print statement from fake_subprocess

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/python-source
Line 
1import popen2
2import os
3class subprocess:
4    PIPE=None
5    def make_cmd(cmd, stdout=None, stderr=None):
6        cmd = " ".join(cmd)
7        if stdout:
8           cmd += " >%s" % stdout.name
9        if stderr:
10           cmd += " 2>%s" % stderr.name
11        return cmd
12    make_cmd = staticmethod(make_cmd)
13    def call(cmd, stdout=None, stderr=None):
14        cmd = subprocess.make_cmd(cmd, stdout, stderr)
15        p = popen2.Popen3(cmd)
16        p.wait()
17        return p.poll()
18    call = staticmethod(call)
19    def Popen(cmd, stdout=None, stderr=None):
20        cmd = subprocess.make_cmd(cmd, stdout, stderr)
21        p = os.popen(cmd)
22        class ret:
23            def communicate(self):
24                r = p.read()
25                if r.endswith("\n"):
26                    r = r[:-1]
27                return [r]
28        return ret()
29    Popen = staticmethod(Popen)
Note: See TracBrowser for help on using the browser.