From fececfa81a5b142c9325688783b78cbda9cf9054 Mon Sep 17 00:00:00 2001 From: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Thu, 5 Feb 2026 10:18:50 -0800 Subject: [PATCH 1/4] fix: update tracing subscriber to write JSON output to stderr --- crates/pet/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/pet/src/lib.rs b/crates/pet/src/lib.rs index ce5aa02e..3f87ccaa 100644 --- a/crates/pet/src/lib.rs +++ b/crates/pet/src/lib.rs @@ -47,7 +47,7 @@ pub fn initialize_tracing(verbose: bool) { if use_json { tracing_subscriber::registry() .with(filter) - .with(fmt::layer().json()) + .with(fmt::layer().json().with_writer(std::io::stderr)) .init(); } else { tracing_subscriber::registry() @@ -55,7 +55,8 @@ pub fn initialize_tracing(verbose: bool) { .with( fmt::layer() .with_target(true) - .with_timer(fmt::time::uptime()), + .with_timer(fmt::time::uptime()) + .with_writer(std::io::stderr), ) .init(); } From e24de7c3645a884d7890969a71a548e44d78a559 Mon Sep 17 00:00:00 2001 From: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Thu, 5 Feb 2026 20:10:14 -0800 Subject: [PATCH 2/4] add environment path verbose output for discovered environments --- crates/pet-reporter/src/stdio.rs | 17 +++++++++++++++++ crates/pet/src/lib.rs | 20 ++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/crates/pet-reporter/src/stdio.rs b/crates/pet-reporter/src/stdio.rs index fec15194..d6cf17da 100644 --- a/crates/pet-reporter/src/stdio.rs +++ b/crates/pet-reporter/src/stdio.rs @@ -18,12 +18,14 @@ pub struct StdioReporter { print_list: bool, managers: Arc>>, environments: Arc, u16>>>, + environment_paths: Arc, Vec>>>, kind: Option, } pub struct Summary { pub managers: HashMap, pub environments: HashMap, u16>, + pub environment_paths: HashMap, Vec>, } impl StdioReporter { @@ -33,9 +35,14 @@ impl StdioReporter { .environments .lock() .expect("environments mutex poisoned"); + let environment_paths = self + .environment_paths + .lock() + .expect("environment_paths mutex poisoned"); Summary { managers: managers.clone(), environments: environments.clone(), + environment_paths: environment_paths.clone(), } } } @@ -62,6 +69,15 @@ impl Reporter for StdioReporter { .expect("environments mutex poisoned"); let count = environments.get(&env.kind).unwrap_or(&0) + 1; environments.insert(env.kind, count); + + // Store the environment details for verbose reporting + let mut environment_paths = self + .environment_paths + .lock() + .expect("environment_paths mutex poisoned"); + let paths = environment_paths.entry(env.kind).or_insert_with(Vec::new); + paths.push(env.clone()); + if self.print_list { println!("{env}") } @@ -73,6 +89,7 @@ pub fn create_reporter(print_list: bool, kind: Option) -> print_list, managers: Arc::new(Mutex::new(HashMap::new())), environments: Arc::new(Mutex::new(HashMap::new())), + environment_paths: Arc::new(Mutex::new(HashMap::new())), kind, } } diff --git a/crates/pet/src/lib.rs b/crates/pet/src/lib.rs index 3f87ccaa..41a524cf 100644 --- a/crates/pet/src/lib.rs +++ b/crates/pet/src/lib.rs @@ -197,6 +197,26 @@ fn find_envs( } let summary = stdio_reporter.get_summary(); + + // If verbose, print the paths of discovered environments first + if options.verbose && !summary.environment_paths.is_empty() { + println!("Environment Paths:"); + println!("------------------"); + for (kind, envs) in summary + .environment_paths + .iter() + { + let kind_str = kind.map(|v| format!("{v:?}")).unwrap_or("Unknown".to_string()); + println!("\n{kind_str}:"); + for env in envs { + if let Some(executable) = &env.executable { + println!(" - {}", executable.display()); + } + } + } + println!() + } + if !summary.managers.is_empty() { println!("Managers:"); println!("---------"); From 418954b0b1bec89a7d4a2559f5c199ce1d7b67d7 Mon Sep 17 00:00:00 2001 From: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Thu, 5 Feb 2026 20:17:27 -0800 Subject: [PATCH 3/4] formatting --- crates/pet/src/lib.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/crates/pet/src/lib.rs b/crates/pet/src/lib.rs index 41a524cf..b4635fbd 100644 --- a/crates/pet/src/lib.rs +++ b/crates/pet/src/lib.rs @@ -197,16 +197,15 @@ fn find_envs( } let summary = stdio_reporter.get_summary(); - + // If verbose, print the paths of discovered environments first if options.verbose && !summary.environment_paths.is_empty() { println!("Environment Paths:"); println!("------------------"); - for (kind, envs) in summary - .environment_paths - .iter() - { - let kind_str = kind.map(|v| format!("{v:?}")).unwrap_or("Unknown".to_string()); + for (kind, envs) in summary.environment_paths.iter() { + let kind_str = kind + .map(|v| format!("{v:?}")) + .unwrap_or("Unknown".to_string()); println!("\n{kind_str}:"); for env in envs { if let Some(executable) = &env.executable { @@ -216,7 +215,7 @@ fn find_envs( } println!() } - + if !summary.managers.is_empty() { println!("Managers:"); println!("---------"); From bc23e885285d9a05f2078b2ee83fda2fb7cd3e5b Mon Sep 17 00:00:00 2001 From: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com> Date: Thu, 5 Feb 2026 20:27:16 -0800 Subject: [PATCH 4/4] fixed --- crates/pet-reporter/src/stdio.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/pet-reporter/src/stdio.rs b/crates/pet-reporter/src/stdio.rs index d6cf17da..3166f7a3 100644 --- a/crates/pet-reporter/src/stdio.rs +++ b/crates/pet-reporter/src/stdio.rs @@ -75,7 +75,7 @@ impl Reporter for StdioReporter { .environment_paths .lock() .expect("environment_paths mutex poisoned"); - let paths = environment_paths.entry(env.kind).or_insert_with(Vec::new); + let paths = environment_paths.entry(env.kind).or_default(); paths.push(env.clone()); if self.print_list {