rust-lang/rustfix

dirty-directory detection warning pollutes terminal, doesn't fire for development build

Closed this issue · 2 comments

This one needs a screenshot to explain:

cargo_fix_terminal

After running into the dirty-directory warning, the terminal is still bold. We may need to wrap the call to bail! with something that sends a \x1b[0m before exiting. Interestingly (probably a separate bug), this was only observed with a copy of cargo-fix installed via cargo install cargo-fix --git https://github.com/rust-lang-nursery/rustfix; a binary built via cargo build in a rustfix repo checkout and called by its absolute path, didn't detect the dirty directory.

Good catch! The is not the bail itself but how it gets rendered in fn main, specifically, after this block

https://github.com/rust-lang-nursery/rustfix/blob/28dbb436c4bce497096af5c360965ee05cb69c76/cargo-fix/src/main.rs#L50-L52

we are missing a stream.reset()?;. Feel free to open a PR to add it! :)

Interestingly (probably a separate bug), this was only observed with a copy of cargo-fix installed via cargo install [...] a binary built via cargo build in a rustfix repo checkout and called by its absolute path, didn't detect the dirty directory.

(Can't reproduce this part; probably my dev build was outdated and I didn't notice.)