Get the output when there's an error? #29
-
Hi! Is it possible to fetch the output (std and err) from when command fails? Thanks :) |
Beta Was this translation helpful? Give feedback.
Answered by
rust-shell-script
Jun 8, 2021
Replies: 1 comment 1 reply
-
My original thought was that if command failed, then the output was not reliable anymore, so it was better to just return error. Do you have a concrete example about such usage ? I guess you can use |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
gak
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My original thought was that if command failed, then the output was not reliable anymore, so it was better to just return error. Do you have a concrete example about such usage ?
I guess you can use
spawn!(xxx 2>&1)?.wait_with_pipe(&mut |pipe| {...})
for now. In the future, I could add a builtin commandignore
for such cases, similar to rustup install script.