Skip to content

Commit 3c4118a

Browse files
committed
fix: only display pipe error in CODSPEED_ENV
1 parent 9114511 commit 3c4118a

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

  • crates
    • criterion_compat/criterion_fork/src/analysis
    • divan_compat/divan_fork/src

crates/criterion_compat/criterion_fork/src/analysis/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,12 @@ mod codspeed {
297297
) {
298298
let (uri, bench_name) = create_uri_and_name(id, c);
299299

300-
if let Err(error) = ::codspeed::fifo::send_cmd(codspeed::fifo::Command::CurrentBenchmark {
300+
let result = ::codspeed::fifo::send_cmd(codspeed::fifo::Command::CurrentBenchmark {
301301
pid: std::process::id(),
302302
uri: uri.clone(),
303-
}) {
304-
eprintln!("Failed to send benchmark URI to runner: {}", error);
303+
});
304+
if result.is_err() && std::env::var("CODSPEED_ENV").is_ok() {
305+
eprintln!("Failed to send benchmark URI to runner: {error:?}");
305306
}
306307

307308
let avg_iter_per_round = iters.iter().sum::<f64>() / iters.len() as f64;

crates/divan_compat/divan_fork/src/divan.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,11 +428,12 @@ mod codspeed {
428428
bench_context.samples.time_samples.iter().map(|s| s.duration.picos / 1_000).collect();
429429
let max_time_ns = bench_context.options.max_time.map(|t| t.as_nanos());
430430

431-
if let Err(error) = ::codspeed::fifo::send_cmd(codspeed::fifo::Command::CurrentBenchmark {
431+
let result = ::codspeed::fifo::send_cmd(codspeed::fifo::Command::CurrentBenchmark {
432432
pid: std::process::id(),
433433
uri: uri.clone(),
434-
}) {
435-
eprintln!("Failed to send benchmark URI to runner: {}", error);
434+
});
435+
if result.is_err() && std::env::var("CODSPEED_ENV").is_ok() {
436+
eprintln!("Failed to send benchmark URI to runner: {error:?}");
436437
}
437438

438439
::codspeed::walltime::collect_raw_walltime_results(

0 commit comments

Comments
 (0)