| 618 | |
| 619 | |
| 620 | def execute_subprocess_async(cmd, env=None, stdin=None, timeout=180, quiet=False, echo=True) -> _RunOutput: |
| 621 | loop = asyncio.get_event_loop() |
| 622 | result = loop.run_until_complete( |
| 623 | _stream_subprocess(cmd, env=env, stdin=stdin, timeout=timeout, quiet=quiet, echo=echo) |
| 624 | ) |
| 625 | |
| 626 | cmd_str = " ".join(cmd) |
| 627 | if result.returncode > 0: |
| 628 | stderr = "\n".join(result.stderr) |
| 629 | raise RuntimeError( |
| 630 | f"'{cmd_str}' failed with returncode {result.returncode}\n\n" |
| 631 | f"The combined stderr from workers follows:\n{stderr}" |
| 632 | ) |
| 633 | |
| 634 | # check that the subprocess actually did run and produced some output, should the test rely on |
| 635 | # the remote side to do the testing |
| 636 | if not result.stdout and not result.stderr: |
| 637 | raise RuntimeError(f"'{cmd_str}' produced no output.") |
| 638 | |
| 639 | return result |
| 640 | |
| 641 | |
| 642 | def pytest_xdist_worker_id(): |