(command, env, timeout=30)
| 63 | |
| 64 | |
| 65 | def run(command, env, timeout=30): |
| 66 | try: |
| 67 | return subprocess.run( |
| 68 | [str(part) for part in command], |
| 69 | input=b"", |
| 70 | capture_output=True, |
| 71 | env=env, |
| 72 | timeout=timeout, |
| 73 | ) |
| 74 | except subprocess.TimeoutExpired as exc: |
| 75 | raise GuardFailure( |
| 76 | "command exceeded %ss: %s" % (timeout, " ".join(map(str, command))) |
| 77 | ) from exc |
| 78 | |
| 79 | |
| 80 | def isolated_environment(work): |
no test coverage detected