Correctly detect color support
This commit is contained in:
parent
fd4a33cbbe
commit
95ee1fc7ea
1 changed files with 4 additions and 2 deletions
|
@ -428,11 +428,13 @@ crate fn make_test(
|
|||
// Any errors in parsing should also appear when the doctest is compiled for real, so just
|
||||
// send all the errors that librustc_ast emits directly into a `Sink` instead of stderr.
|
||||
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
|
||||
supports_color =
|
||||
EmitterWriter::stderr(ColorConfig::Auto, None, false, false, Some(80), false)
|
||||
.supports_color();
|
||||
|
||||
let emitter =
|
||||
EmitterWriter::new(box io::sink(), None, false, false, false, None, false);
|
||||
|
||||
supports_color = emitter.supports_color();
|
||||
|
||||
// FIXME(misdreavus): pass `-Z treat-err-as-bug` to the doctest parser
|
||||
let handler = Handler::with_emitter(false, None, box emitter);
|
||||
let sess = ParseSess::with_span_handler(handler, sm);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue