unix: Relax escaping in Debug
impl on Command
by madsmtm · Pull Request #132484 · rust-lang/rust (original) (raw)
The Debug
output of Command
is very useful for showing to the user the command that was executed when something went wrong. This is done for example by rustc
when invoking an external tool like the linker fails.
It is also overly verbose, since everything is quoted, which makes it harder to read. Instead, we now first check if we're reasonably sure that an argument is simple enough that using it in the shell wouldn't need quoting, and then output it without quotes if possible.
An example of output before could look like this:
PATH="/a:/b" "cc" "foo.o" "-target" "arm64-apple-darwin11.0" "some path with spaces"
Now it looks like this:
PATH=/a:/b cc foo.o -target arm64-apple-darwin11.0 "some path with spaces"
This is naturally a behavioural change, but I believe it's allowed by the docs.
r? libs