| 1742 | print("failed to clean up {}: {}".format(link, ex)) |
| 1743 | |
| 1744 | def _call(self, python, args, env, returncode): |
| 1745 | import subprocess |
| 1746 | cmd = [python, *args] |
| 1747 | p = subprocess.Popen(cmd, stdout=subprocess.PIPE, |
| 1748 | stderr=subprocess.PIPE, env=env) |
| 1749 | r = p.communicate() |
| 1750 | if p.returncode != returncode: |
| 1751 | if verbose: |
| 1752 | print(repr(r[0])) |
| 1753 | print(repr(r[1]), file=sys.stderr) |
| 1754 | raise RuntimeError( |
| 1755 | 'unexpected return code: {0} (0x{0:08X})'.format(p.returncode)) |
| 1756 | return r |
| 1757 | |
| 1758 | def call_real(self, *args, returncode=0): |
| 1759 | return self._call(self.real, args, None, returncode) |