Repository navigation
Driver logging: disable colors when logging to file #78435
Description
Activity
This is the fault of
rust/compiler/rustc_driver/src/lib.rs
Line 1289 in 35debd4
.with_ansi(true) I should be checking for whether the terminal supports colors before activating colors
A workaround until then is to use https://superuser.com/a/380778
Reacted by Ralf Jung- addedA-driverArea: rustc_driver that ties everything together into the `rustc` compilerArea: rustc_driver that ties everything together into the `rustc` compilerand removedA-miriArea: The miri toolArea: The miri tool
on Oct 28, 2020 - changed the title
[-]Miri engine logging: disable colors when logging to file[/-][+]Driver logging: disable colors when logging to file[/+]on Oct 28, 2020 How can I run miri from the rust repo? (i.e. built using
./x.py build)You can run the test suite with
./x.py test --stage 0 src/tools/miri, but that's not what you were asking... that's not supported yet unfortunately: #76666Until then, you'll have to resort to this.
Some of the
x.pycommands might need adjusting though asx.pychanged.Ah, thanks! I forgot about that part of the docs :)
Hmm, I'm getting this error:
error[E0463]: can't find crate for `rustc_attr` --> src/lib.rs:14:1 | 14 | extern crate rustc_attr; | ^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate error: aborting due to previous errorI'm using the latest master rustc and the latest miri. Is miri broken right now?
EDIT: Oh, I think I need
--stage 2.Yeah looks like you are using the wrong stage or so. The docs are from back when stage 2 was the default...
Reacted by Noah Lev- addedC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.
on Oct 29, 2020 - added a commit that references this issue
on Oct 29, 2020 - added a commit that references this issue
on Oct 30, 2020 Looks like the code tests
stdout_isatty, but logging goes to stderr so this is the wrong test.Hmm, I guess I didn't notice any issues because I always redirect stderr to stdout and then view that.
Working on a fix.
Reacted by Ralf JungYeah, for now using
&>logto redirect both to the logfile is an okay work-around.Reacted by Noah Lev@RalfJung FYI you can view the original color with
less -R, which prints them directly to the terminal. That doesn't work in an editor, though.- added a commit that references this issue
on Jan 11, 2021
When debugging a large Miri trace, I like to put the trace into a file that I can analyze and search through in an editor. Unfortunately, since the recent logging changes, that leads to a lot of garbage in the file:
Looks like the color escape sequences are printed even when redirecting to a file. This makes working with the logfile much harder than it was before. Is there a way to fix that?
Cc @oli-obk