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() }));