Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Merge branch 'main' into no-panic-uploads-in-debug

Max Brunsfeldbb0257bbace4
diff --cc crates/zed/src/main.rs
index 2a01236b024,57345b4f695..b9e3ed550be
--- a/crates/zed/src/main.rs
+++ b/crates/zed/src/main.rs
@@@ -332,18 -331,24 +333,23 @@@ fn init_panic_hook(app_version: String
),
};
+ if is_pty {
+ eprintln!("{}", message);
- } else {
- log::error!(target: "panic", "{}", message);
- let panic_filename = chrono::Utc::now().format("%Y_%m_%d %H_%M_%S").to_string();
- std::fs::write(
- paths::LOGS_DIR.join(format!("zed-{}-{}.panic", app_version, panic_filename)),
- &message,
- )
- .context("error writing panic to disk")
++ return;
++ }
++
+ let timestamp = chrono::Utc::now().format("%Y_%m_%d %H_%M_%S").to_string();
+ let panic_file_path =
+ paths::LOGS_DIR.join(format!("zed-{}-{}.panic", app_version, timestamp));
+ let panic_file = std::fs::OpenOptions::new()
+ .append(true)
+ .create(true)
+ .open(&panic_file_path)
.log_err();
+ if let Some(mut panic_file) = panic_file {
+ write!(&mut panic_file, "{}", message).log_err();
+ panic_file.flush().log_err();
}
-
- if is_pty {
- eprintln!("{}", message);
- } else {
- log::error!(target: "panic", "{}", message);
- }
}));
}