Merge pull request #2235 from zed-industries/no-panic-uploads-in-debug

Don't upload panic files when running in a PTY
This commit is contained in:
Max Brunsfeld 2023-03-04 09:42:46 -08:00 committed by GitHub
commit 01bbf20962
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -120,7 +120,9 @@ fn main() {
)); ));
watch_settings_file(default_settings, settings_file_content, themes.clone(), cx); watch_settings_file(default_settings, settings_file_content, themes.clone(), cx);
if !stdout_is_a_pty() {
upload_previous_panics(http.clone(), cx); upload_previous_panics(http.clone(), cx);
}
let client = client::Client::new(http.clone(), cx); let client = client::Client::new(http.clone(), cx);
let mut languages = LanguageRegistry::new(login_shell_env_loaded); let mut languages = LanguageRegistry::new(login_shell_env_loaded);
@ -331,6 +333,11 @@ fn init_panic_hook(app_version: String) {
), ),
}; };
if is_pty {
eprintln!("{}", message);
return;
}
let timestamp = chrono::Utc::now().format("%Y_%m_%d %H_%M_%S").to_string(); let timestamp = chrono::Utc::now().format("%Y_%m_%d %H_%M_%S").to_string();
let panic_file_path = let panic_file_path =
paths::LOGS_DIR.join(format!("zed-{}-{}.panic", app_version, timestamp)); paths::LOGS_DIR.join(format!("zed-{}-{}.panic", app_version, timestamp));
@ -343,12 +350,6 @@ fn init_panic_hook(app_version: String) {
write!(&mut panic_file, "{}", message).log_err(); write!(&mut panic_file, "{}", message).log_err();
panic_file.flush().log_err(); panic_file.flush().log_err();
} }
if is_pty {
eprintln!("{}", message);
} else {
log::error!(target: "panic", "{}", message);
}
})); }));
} }