fix(handler): remove the two extra `is_terminal` sys call from `MietteHandlerOpts::build`

`GraphicalReportHandler::new()` calls `GraphicalTheme::default()`

7ff4f874d6/src/handlers/graphical.rs (L52)

which calls `std::io::stdout().is_terminal()` and `std::io::stderr().is_terminal()`

7ff4f874d6/src/handlers/theme.rs (L72)

but this default theme is overridden by `with_theme(theme)`.
This commit is contained in:
Boshen 2023-12-23 23:31:23 +08:00
parent 7ff4f874d6
commit 0c87eb4a82
No known key found for this signature in database
GPG Key ID: 9C7A8C8AB22BEBD1
1 changed files with 2 additions and 3 deletions

View File

@ -237,10 +237,9 @@ impl MietteHandlerOpts {
ThemeStyles::none()
};
let theme = self.theme.unwrap_or(GraphicalTheme { characters, styles });
let mut handler = GraphicalReportHandler::new()
let mut handler = GraphicalReportHandler::new_themed(theme)
.with_width(width)
.with_links(linkify)
.with_theme(theme);
.with_links(linkify);
if let Some(with_cause_chain) = self.with_cause_chain {
if with_cause_chain {
handler = handler.with_cause_chain();