Read output from command. Returns the output text on success. On failure, terminates execution, unless ignore_error is True, when it returns an empty string. If raw is True, do not attempt to decode output text.
(c, ignore_error=False, raw=False, *k, **kw)
| 360 | |
| 361 | |
| 362 | def read_pipe(c, ignore_error=False, raw=False, *k, **kw): |
| 363 | """Read output from command. Returns the output text on success. On |
| 364 | failure, terminates execution, unless ignore_error is True, when it |
| 365 | returns an empty string. |
| 366 | |
| 367 | If raw is True, do not attempt to decode output text. |
| 368 | """ |
| 369 | retcode, out, err = read_pipe_full(c, *k, **kw) |
| 370 | if retcode != 0: |
| 371 | if ignore_error: |
| 372 | out = "" |
| 373 | else: |
| 374 | die('Command failed: {}\nError: {}'.format(' '.join(c), err)) |
| 375 | if not raw: |
| 376 | out = decode_text_stream(out) |
| 377 | return out |
| 378 | |
| 379 | |
| 380 | def read_pipe_text(c, *k, **kw): |
no test coverage detected