-
-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use --color=always
in rustdoc command when stderr is tty
#360
Conversation
81d533a
to
8e0be8c
Compare
8e0be8c
to
4de3203
Compare
src/rustdoc_cmd.rs
Outdated
if atty::is(atty::Stream::Stderr) { | ||
cmd.arg("--color=always"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this reference the GlobalConfig
struct's stderr
value instead of the global stderr, just in case they are different?
This might need a bit more plumbing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But isn't anyhow::bail!
using the normal stderr, and that's where this command's output will go?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cargo-semver-checks/src/rustdoc_cmd.rs
Line 92 in 4de3203
anyhow::bail!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is an excellent point!
We should change that too, before a "cargo-semver-checks-as-a-library" user opens an issue about their library polluting their stderr even though they configured its stderr behavior to be something else.
I take it back: bail!()
doesn't print to stderr, it's just return Err()
with that error message: https://docs.rs/anyhow/latest/anyhow/macro.bail.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. But nevertheless it should use the GlobalConfig
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 8f7d387.
Yes, I think so.
…On Mon, Feb 20, 2023, 8:29 AM Tomasz Nowak ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/rustdoc_cmd.rs
<#360 (comment)>
:
> + if atty::is(atty::Stream::Stderr) {
+ cmd.arg("--color=always");
+ }
I see. But nevertheless it should use the GlobalConfig, right?
—
Reply to this email directly, view it on GitHub
<#360 (comment)>,
or unsubscribe
</~https://github.com/notifications/unsubscribe-auth/AAR5MSXBSWCA67KNJJJCRTTWYNWUTANCNFSM6AAAAAAUWWGVO4>
.
You are receiving this because your review was requested.Message ID:
***@***.***>
|
Why is the CI failing? I don't understand it. The compilation error references line numbers in |
Possibly due to merging I just merged |
--color=always
in rustdoc command when stderr is tty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Fixes #326