From 764cc8bb3d628cb60913c33aed86981dbde9b6c1 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 2 Apr 2023 14:44:41 -0700 Subject: [PATCH] skip pruning old logs unless we are the gui refs: #3402 --- env-bootstrap/src/ringlog.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/env-bootstrap/src/ringlog.rs b/env-bootstrap/src/ringlog.rs index e12f46865..083d26d52 100644 --- a/env-bootstrap/src/ringlog.rs +++ b/env-bootstrap/src/ringlog.rs @@ -260,13 +260,18 @@ fn prune_old_logs() { } fn setup_pretty() -> (LevelFilter, Logger) { - prune_old_logs(); - let base_name = std::env::current_exe() .ok() .and_then(|p| p.file_name().map(|s| s.to_string_lossy().to_string())) .unwrap_or_else(|| "wezterm".to_string()); + if base_name.contains("gui") { + // Only tidy up logs when the gui process is starting. + // rationale: `wezterm cli` commands should have as low startup + // overhead as possible + prune_old_logs(); + } + let log_file_name = config::RUNTIME_DIR.join(format!("{}-log-{}.txt", base_name, unsafe { libc::getpid() }));