From 9b6eaae860e4d98ed5afaef740d224aaa49eba42 Mon Sep 17 00:00:00 2001 From: Techassi Date: Tue, 7 Apr 2026 12:54:41 +0200 Subject: [PATCH] fix(patchable): Only print ANSI if stdout is terminal --- rust/patchable/src/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/rust/patchable/src/main.rs b/rust/patchable/src/main.rs index 1a5548538..8ab1fa462 100644 --- a/rust/patchable/src/main.rs +++ b/rust/patchable/src/main.rs @@ -5,7 +5,11 @@ mod repo; mod utils; use core::str; -use std::{fs::File, io::Write, path::PathBuf}; +use std::{ + fs::File, + io::{IsTerminal, Write}, + path::PathBuf, +}; use git2::{Oid, Repository}; use serde::{Deserialize, Serialize}; @@ -327,7 +331,11 @@ type Result = std::result::Result; #[snafu::report] fn main() -> Result<()> { tracing_subscriber::registry() - .with(tracing_subscriber::fmt::layer().with_writer(std::io::stderr)) + .with( + tracing_subscriber::fmt::layer() + .with_ansi(std::io::stdout().is_terminal()) + .with_writer(std::io::stderr), + ) .with(IndicatifLayer::new()) .with( tracing_subscriber::EnvFilter::builder()