Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(fmt): Fix passing of WriteStyle when using Target::Pipe #302

Merged
merged 1 commit into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/fmt/writer/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ impl BufferWriter {
}
}

pub(in crate::fmt::writer) fn pipe(pipe: Box<Mutex<dyn io::Write + Send + 'static>>) -> Self {
pub(in crate::fmt::writer) fn pipe(
pipe: Box<Mutex<dyn io::Write + Send + 'static>>,
write_style: WriteStyle,
) -> Self {
BufferWriter {
target: WritableTarget::Pipe(pipe),
write_style: WriteStyle::Never,
write_style,
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/fmt/writer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl Builder {
let writer = match mem::take(&mut self.target) {
Target::Stdout => BufferWriter::stdout(self.is_test, color_choice),
Target::Stderr => BufferWriter::stderr(self.is_test, color_choice),
Target::Pipe(pipe) => BufferWriter::pipe(Box::new(Mutex::new(pipe))),
Target::Pipe(pipe) => BufferWriter::pipe(Box::new(Mutex::new(pipe)), color_choice),
};

Writer { inner: writer }
Expand Down