-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Fully capture rustc and rustdoc output when -Zcompile-progress is passed #5862
Conversation
JobQueue::drain_the_queue() could thus stop checking for `extra_verbose()`.
This prepares us for capturing output from these compilers.
(rust_highfive has picked a reviewer for you, use r? to override) |
Great work. I'm not sure we should special case Windows here - at a little sacrifice of efficiency, we can just:
|
@dwijnand they are already closed so I choose the human syntax instead 😄. |
(rust-lang/rust#53003 has been merged so this is unblocked.) |
@kennytm Do you have some opinions on #5862 (comment)? |
@ishitatsuyuki I don't see any advantage doing that. I'll let the reviewers decide. |
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 agree with @kennytm that not always passing --color always
feels like the best strategy here.
@kennytm to confirm, when --color always
is passed to rustc on windows when stderr is a pipe, that means that termcolor
, the compiler's currently terminal coloring library (I think?), will turn on ANSI unconditionally, despite being on Windows?
I want to test this a bit locally to make sure it still works, it'll take me a bit though to run it on a Windows machine.
let shell = bcx.config.shell(); | ||
if capture_output || shell.color_choice() != ColorChoice::CargoAuto { | ||
let color = if shell.supports_color() { "always" } else { "never" }; | ||
cmd.args(&["--color", color]); |
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.
This is slightly different than the previous invocation that was moved up from below, but I think it's equivalent, right?
Previously if I pass --color never
to Cargo it'll forward that to rustc unconditionally. I think that'll happen here because stream.supports_color()
is already set to return false
unconditionally inside of termcolor
, I think?
(and I believe the reverse is true for --color always
)
Just wanted to make sure!
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.
Previously if I pass --color never to Cargo it'll forward that to rustc unconditionally. I think that'll happen here because stream.supports_color() is already set to return false unconditionally inside of termcolor, I think?
Yes. supports_color()
will return false
if the stream is "NoColor", and true
otherwise.
When a stream is created, it will create the "NoColor" variant if ColorChoice::should_attempt_color()
returns false
, which is when --color never
or --color auto
with $TERM ≠ "dumb".
Thus --color never
will imply supports_color()
returns false
unconditionally.
📌 Commit 641f7ff has been approved by |
Fully capture rustc and rustdoc output when -Zcompile-progress is passed Fixes #5764 and #5695. On Windows, we will parse the ANSI escape code into console commands via my `fwdansi` package, based on @ishitatsuyuki's idea in #5695 (comment). Outside of Windows the content is forwarded as-is.
@alexcrichton Yes :) |
☀️ Test successful - status-appveyor, status-travis |
Update cargo - Update transitioning url (rust-lang/cargo#5889) - Resolve some clippy lint warnings (rust-lang/cargo#5884) - Don't kill child processes on normal exit on Windows (rust-lang/cargo#5887) - fix a bunch of clippy warnings (rust-lang/cargo#5876) - Add support for rustc's --error-format short (rust-lang/cargo#5879) - Support JSON with rustdoc. (rust-lang/cargo#5878) - Fix rustfmt instructions in CONTRIBUTING.md (rust-lang/cargo#5880) - Allow `cargo run` in workspaces. (rust-lang/cargo#5877) - Change target filters in workspaces. (rust-lang/cargo#5873) - Improve verbose console and log for finding git repo in package check (rust-lang/cargo#5858) - Meta rename (rust-lang/cargo#5871) - fetch: skip target tests when cross_compile is disabled (rust-lang/cargo#5870) - Fully capture rustc and rustdoc output when -Zcompile-progress is passed (rust-lang/cargo#5862) - Fix test --example docs. (rust-lang/cargo#5867) - Add a feature to build a vendored OpenSSL (rust-lang/cargo#5865)
@kennytm I'd say this is probably ready to stabilize, but curious what you think? |
SGTM, I'll prepare a PR. |
Fixes #5764 and #5695.
On Windows, we will parse the ANSI escape code into console commands via my
fwdansi
package, based on @ishitatsuyuki's idea in #5695 (comment). Outside of Windows the content is forwarded as-is.