Run a command and return its stdout/stderr as a string. Parameters ---------- cmd : str or list A command to be executed in the system shell. Returns ------- output : str A string containing the combination of stdout and stderr from the subprocess, in wh
(cmd: str | list[str])
| 122 | |
| 123 | |
| 124 | def getoutput(cmd: str | list[str]) -> str: |
| 125 | """Run a command and return its stdout/stderr as a string. |
| 126 | |
| 127 | Parameters |
| 128 | ---------- |
| 129 | cmd : str or list |
| 130 | A command to be executed in the system shell. |
| 131 | |
| 132 | Returns |
| 133 | ------- |
| 134 | output : str |
| 135 | A string containing the combination of stdout and stderr from the |
| 136 | subprocess, in whatever order the subprocess originally wrote to its |
| 137 | file descriptors (so the order of the information in this string is the |
| 138 | correct order as would be seen if running the command in a terminal). |
| 139 | """ |
| 140 | out = process_handler(cmd, lambda p: p.communicate()[0], subprocess.STDOUT) |
| 141 | if out is None: |
| 142 | return '' |
| 143 | return py3compat.decode(out) |
| 144 | |
| 145 | |
| 146 | def getoutputerror(cmd: str | list[str]) -> tuple[str, str]: |
nothing calls this directly
no test coverage detected
searching dependent graphs…