| 1668 | print("failed to clean up {}: {}".format(link, ex)) |
| 1669 | |
| 1670 | def _call(self, python, args, env, returncode): |
| 1671 | import subprocess |
| 1672 | cmd = [python, *args] |
| 1673 | p = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
| 1674 | stderr=subprocess.PIPE, env=env) |
| 1675 | r = p.communicate() |
| 1676 | if p.returncode != returncode: |
| 1677 | if verbose: |
| 1678 | print(repr(r[0])) |
| 1679 | print(repr(r[1]), file=sys.stderr) |
| 1680 | raise RuntimeError( |
| 1681 | 'unexpected return code: {0} (0x{0:08X})'.format(p.returncode)) |
| 1682 | return r |
| 1683 | |
| 1684 | def call_real(self, *args, returncode=0): |
| 1685 | return self._call(self.real, args, None, returncode) |