skip pruning old logs unless we are the gui

refs: #3402
This commit is contained in:
Wez Furlong committed 2023-04-02 14:44:41 -07:00
1 parent 49296500da
commit 764cc8bb3d
1 file changed
+7 -2
+7 -2
View File
@@ -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()
}));