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.

Don't generate crash reports on the Dev channel (#35915)

Julia Ryan021681d4563d
diff --git a/Cargo.lock b/Cargo.lock
index 6f434e86859..1ae4303c71b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4014,6 +4014,7 @@ dependencies = [
"log",
"minidumper",
"paths",
+ "release_channel",
"smol",
"workspace-hack",
]
diff --git a/crates/crashes/Cargo.toml b/crates/crashes/Cargo.toml
index 641a97765a7..afb4936b637 100644
--- a/crates/crashes/Cargo.toml
+++ b/crates/crashes/Cargo.toml
@@ -10,6 +10,7 @@ crash-handler.workspace = true
log.workspace = true
minidumper.workspace = true
paths.workspace = true
+release_channel.workspace = true
smol.workspace = true
workspace-hack.workspace = true
diff --git a/crates/crashes/src/crashes.rs b/crates/crashes/src/crashes.rs
index cfb4b57d5df..5b9ae0b5460 100644
--- a/crates/crashes/src/crashes.rs
+++ b/crates/crashes/src/crashes.rs
@@ -1,6 +1,7 @@
use crash_handler::CrashHandler;
use log::info;
use minidumper::{Client, LoopAction, MinidumpBinary};
+use release_channel::{RELEASE_CHANNEL, ReleaseChannel};
use std::{
env,
@@ -9,7 +10,7 @@ use std::{
path::{Path, PathBuf},
process::{self, Command},
sync::{
- OnceLock,
+ LazyLock, OnceLock,
atomic::{AtomicBool, Ordering},
},
thread,
@@ -22,7 +23,14 @@ pub static CRASH_HANDLER: AtomicBool = AtomicBool::new(false);
pub static REQUESTED_MINIDUMP: AtomicBool = AtomicBool::new(false);
const CRASH_HANDLER_TIMEOUT: Duration = Duration::from_secs(60);
+pub static GENERATE_MINIDUMPS: LazyLock<bool> = LazyLock::new(|| {
+ *RELEASE_CHANNEL != ReleaseChannel::Dev || env::var("ZED_GENERATE_MINIDUMPS").is_ok()
+});
+
pub async fn init(id: String) {
+ if !*GENERATE_MINIDUMPS {
+ return;
+ }
let exe = env::current_exe().expect("unable to find ourselves");
let zed_pid = process::id();
// TODO: we should be able to get away with using 1 crash-handler process per machine,
@@ -138,6 +146,9 @@ impl minidumper::ServerHandler for CrashServer {
}
pub fn handle_panic() {
+ if !*GENERATE_MINIDUMPS {
+ return;
+ }
// wait 500ms for the crash handler process to start up
// if it's still not there just write panic info and no minidump
let retry_frequency = Duration::from_millis(100);