From 0dfbddd27545e0664aa4bb312b9d73916c4e48ab Mon Sep 17 00:00:00 2001 From: konsti Date: Thu, 11 Jan 2024 14:53:13 +0100 Subject: [PATCH] Shorten resolve many dev output (#885) --- crates/puffin-dev/src/resolve_many.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/crates/puffin-dev/src/resolve_many.rs b/crates/puffin-dev/src/resolve_many.rs index 9b3d5f3e4..1dc73fcd1 100644 --- a/crates/puffin-dev/src/resolve_many.rs +++ b/crates/puffin-dev/src/resolve_many.rs @@ -151,7 +151,20 @@ pub(crate) async fn resolve_many(args: ResolveManyArgs) -> Result<()> { { "Building source distributions is disabled".to_string() } else { - format!("{err:?}") + err.chain() + .map(|err| { + let formatted = err.to_string(); + // Cut overly long c/c++ compile output + if formatted.lines().count() > 20 { + let formatted: Vec<_> = formatted.lines().collect(); + formatted[..20].join("\n") + + "\n[...]\n" + + &formatted[formatted.len() - 20..].join("\n") + } else { + formatted + } + }) + .join("\n Caused by: ") }; info!( "Error for {} ({}/{}, {} ms): {}",