(command: list[str])
| 29 | |
| 30 | |
| 31 | def execute(command: list[str]) -> None: |
| 32 | proc = subprocess.Popen( |
| 33 | " ".join(command), stderr=subprocess.PIPE, stdout=subprocess.PIPE, shell=True |
| 34 | ) |
| 35 | stdout_bytes, stderr_bytes = proc.communicate() |
| 36 | stdout, stderr = stdout_bytes.decode("utf-8"), stderr_bytes.decode("utf-8") |
| 37 | if proc.returncode != 0: |
| 38 | print("EXECUTED COMMAND:", repr(command)) |
| 39 | print("RETURN CODE:", proc.returncode) |
| 40 | print() |
| 41 | print("STDOUT:") |
| 42 | print_offset(stdout) |
| 43 | print("STDERR:") |
| 44 | print_offset(stderr) |
| 45 | raise RuntimeError("Unexpected error from external tool.") |
| 46 | |
| 47 | |
| 48 | def trial(num_trials: int, command: Command) -> list[float]: |
no test coverage detected
searching dependent graphs…