#command-output #command #debugging #display #fmt

command-unquoted

std::process::Command wrapper with a nicer Debug implementation

1 stable release

1.0.0 Aug 27, 2024

#125 in Value formatting

MPL-2.0 license

11KB
185 lines

command-unquoted

A nicer-looking Debug implementation for Rust's std::process::Command.


lib.rs:

command-unquoted provides [a wrapper struct][Unquoted] for std::process::Command that provides a nicer-looking Debug implementation and is useful for logs or user-facing error messages.

Instead of quoting all strings (as done in the Unix Command implementation), quotes are added only where necessary.

As with Command's Debug implementation, this format only approximates an appropriate shell invocation of the program with the provided environment. It may be particularly unsuitable for Windows (patches welcome). Non-UTF-8 data is lossily converted using the UTF-8 replacement character. This format is not stable and may change between releases; only the API of this crate is stable.

To keep the resulting output friendlier (and sometimes due to Rust standard library limitations), the result of these methods are not displayed in this implementation:

No runtime deps