Grepping cargo output

I want to find all places with skip_all_flag when I do initial check via cargo check:

cargo check | rg skip_all_flag
^^^this doesn't work. Why?

Compiler errors from cargo run/cargo build/cargo check go into stderr, not stdout; whereas | only pipes stdout. Searching for how to pipe stderr instead gives possible solutions, e.g. the following is fairly concise:

cargo check 2> >(rg skip_all_flag)

though I don’t understand all the implications of this bash syntax, and some commenter remarked something about it and “stdlog pipe”… IDK. So the more sane approach might be

cargo check 2>&1 >/dev/null | rg skip_all_flag
1 Like

Thanks!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.