1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-22 13:16:39 +03:00

skip pruning old logs unless we are the gui

refs: #3402
This commit is contained in:
Wez Furlong 2023-04-02 14:44:41 -07:00
parent 49296500da
commit 764cc8bb3d
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387

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