(
proc: subprocess.Popen[str],
stdout: str | None,
stderr: str | None,
)
| 274 | |
| 275 | |
| 276 | def make_process_error_msg( |
| 277 | proc: subprocess.Popen[str], |
| 278 | stdout: str | None, |
| 279 | stderr: str | None, |
| 280 | ) -> str: |
| 281 | args = cast(list[str], proc.args) |
| 282 | |
| 283 | # Reuse error message from CalledProcessError |
| 284 | exc = subprocess.CalledProcessError(proc.returncode, " ".join(args)) |
| 285 | |
| 286 | msg = str(exc) |
| 287 | detail = stderr or stdout |
| 288 | if detail and detail.strip(): |
| 289 | # `msg` ends in a period, just append |
| 290 | msg = f"{msg} {detail.strip()}" |
| 291 | |
| 292 | return msg |
no outgoing calls
no test coverage detected