Convert `bytes` in the encoding used by a subprocess into a filesystem-appropriate `str`. Inherited from `exec_command`, and possibly incorrect.
(output)
| 61 | from numpy.distutils import log |
| 62 | |
| 63 | def filepath_from_subprocess_output(output): |
| 64 | """ |
| 65 | Convert `bytes` in the encoding used by a subprocess into a filesystem-appropriate `str`. |
| 66 | |
| 67 | Inherited from `exec_command`, and possibly incorrect. |
| 68 | """ |
| 69 | mylocale = locale.getpreferredencoding(False) |
| 70 | if mylocale is None: |
| 71 | mylocale = 'ascii' |
| 72 | output = output.decode(mylocale, errors='replace') |
| 73 | output = output.replace('\r\n', '\n') |
| 74 | # Another historical oddity |
| 75 | if output[-1:] == '\n': |
| 76 | output = output[:-1] |
| 77 | return output |
| 78 | |
| 79 | |
| 80 | def forward_bytes_to_stdout(val): |
no test coverage detected