Run a subprocess, returning stdout.
(cmd, *, input=None, capture=True, env=None, cwd=None, check=True)
| 114 | |
| 115 | |
| 116 | def run(cmd, *, input=None, capture=True, env=None, cwd=None, check=True): |
| 117 | """Run a subprocess, returning stdout.""" |
| 118 | merged_env = {**os.environ, **(env or {})} |
| 119 | result = subprocess.run( |
| 120 | cmd, |
| 121 | input=input, |
| 122 | capture_output=capture, |
| 123 | text=True, |
| 124 | env=merged_env, |
| 125 | cwd=cwd, |
| 126 | check=check, |
| 127 | ) |
| 128 | return result.stdout if capture else None |
| 129 | |
| 130 | |
| 131 | def check_tools(): |
no test coverage detected