| 1049 | |
| 1050 | |
| 1051 | def print_called_process_error(e): |
| 1052 | for stream_name in ["stdout", "stderr"]: |
| 1053 | content = getattr(e, stream_name) |
| 1054 | if isinstance(content, bytes): |
| 1055 | content = content.decode(*DECODE_ARGS) |
| 1056 | stream = getattr(sys, stream_name) |
| 1057 | if content: |
| 1058 | stream.write(content) |
| 1059 | if not content.endswith("\n"): |
| 1060 | stream.write("\n") |
| 1061 | |
| 1062 | # shlex uses single quotes, so we surround the command with double quotes. |
| 1063 | print( |
| 1064 | f'Command "{join_command(e.cmd)}" returned exit status {e.returncode}' |
| 1065 | ) |
| 1066 | |
| 1067 | |
| 1068 | if __name__ == "__main__": |