| 40 |
| 41 |
| 42 |
| 43 |
| 44 |
| 45 |
| 46 |
| 47 |
| 48 |
| 49 |
| 50 |
| 51 |
| 52 |
| 53 |
| 54 |
| 55 |
| 56 |
| 57 |
| 58 | |
def __init__(self, out=True, err=True, mixed=False, in_=True, patchsys=True): |
if in_: |
self._oldin = (sys.stdin, os.dup(0)) |
sys.stdin = DontReadFromInput() |
fd = os.open(devnullpath, os.O_RDONLY) |
os.dup2(fd, 0) |
os.close(fd) |
if out: |
self.out = py.io.FDCapture(1) |
if patchsys: |
self.out.setasfile('stdout') |
if err: |
if mixed and out: |
tmpfile = self.out.tmpfile |
else: |
tmpfile = None |
self.err = py.io.FDCapture(2, tmpfile=tmpfile) |
if patchsys: |
self.err.setasfile('stderr') | |