Skip to content

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

Merged
zkat merged 1 commit into
zkat:mainfrom
Boshen:reduce-is-terminal-sys-call
Feb 4, 2024
Merged

fix(handler): remove the two extra is_terminal sys call from MietteHandlerOpts::build#325
zkat merged 1 commit into
zkat:mainfrom
Boshen:reduce-is-terminal-sys-call

Conversation

@Boshen

@Boshen Boshen commented Dec 23, 2023

Copy link
Copy Markdown
Contributor

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

theme: GraphicalTheme::default(),

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

_ if !std::io::stdout().is_terminal() || !std::io::stderr().is_terminal() => {

but this default theme is overridden by with_theme(theme).

…eHandlerOpts::build`

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

https://github.com/zkat/miette/blob/7ff4f874d693a665af4df40f4e94505013e3e262/src/handlers/graphical.rs#L52

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

https://github.com/zkat/miette/blob/7ff4f874d693a665af4df40f4e94505013e3e262/src/handlers/theme.rs#L72

but this default theme is overridden by `with_theme(theme)`.
@zkat zkat merged commit f1dc89c into zkat:main Feb 4, 2024
@Boshen Boshen deleted the reduce-is-terminal-sys-call branch February 4, 2024 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants