Commit 988a7e7
authored
docs: show how to stringify the output of Comamnd
This documentation-only change clarifies how the user can get the
string representation of the output of a command.
The `stdout` and `stderr` members of `std::process::Output` from
`std::process::Command` return a Vec<u8>, which is not always what
the user wants.
For simple cases like printing `stderr` iff the `std::process::ExitStatus`
is non-zero, it's useful to get the string representation of this `Vec<u8>`.
This can be done via `String::from_utf8_lossy`, but it's not clear that this
is possible from the documentation without first searching the internet for
an answer.
Link to playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=8189f65dc4b354a643311af2cea5b2301 parent ca4e394 commit 988a7e7
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
477 | | - | |
| 477 | + | |
478 | 478 | | |
479 | 479 | | |
480 | 480 | | |
| |||
0 commit comments