Skip to content

Commit 23724b0

Browse files
committed
Fix color for rustdoc error messages
Due to a change in tracing-subscriber where it escapes ANSI codes, the output from rustdoc was changed to be escaped instead of colored. This fixes the issue by just printing to the console directly. This does not have a test because it is difficult to emulate a terminal in the testsuite, and I don't feel like adding color overrides at the moment. Ref: - #2829 -- Switched to tracing - GHSA-xwfj-jgwm-7wp5 -- CVE-2025-58160 - tokio-rs/tracing#3378 -- Discussion of supporting color codes. Eventually mdbook's primary output should migrate away from using log messages, and instead use a structured console system. However, that's a ways off.
1 parent 6457b38 commit 23724b0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crates/mdbook-driver/src/mdbook.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use std::path::{Path, PathBuf};
2020
use std::process::Command;
2121
use tempfile::Builder as TempFileBuilder;
2222
use topological_sort::TopologicalSort;
23-
use tracing::{debug, error, info, trace, warn};
23+
use tracing::{debug, info, trace, warn};
2424

2525
#[cfg(test)]
2626
mod tests;
@@ -329,8 +329,8 @@ impl MDBook {
329329

330330
if !output.status.success() {
331331
failed = true;
332-
error!(
333-
"rustdoc returned an error:\n\
332+
eprintln!(
333+
"ERROR rustdoc returned an error:\n\
334334
\n--- stdout\n{}\n--- stderr\n{}",
335335
String::from_utf8_lossy(&output.stdout),
336336
String::from_utf8_lossy(&output.stderr)

0 commit comments

Comments
 (0)