zed: Add --system-specs arg (#27285)

Adds the `--system-specs` flag to the Zed binary, so that users who wish
to report issues can retrieve their system specs, even if Zed is failing
to launch

Still TODO:
- [x] Test and do best effort GPU info detection on Linux
- [ ] Modify GitHub issue templates to tell users that the flag is
available if they are unable to launch Zed

Release Notes:

- Added the `--system-specs` flag to the Zed binary (not the cli!), to
retrieve the system specs we ask for in GitHub issues without needing to
open Zed
This commit is contained in:
Ben Kunkle 2025-03-21 21:56:25 -05:00 committed by GitHub
parent 85a761cb2b
commit c783fd072f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 108 additions and 9 deletions

View file

@ -27,6 +27,7 @@ trait InstalledApp {
fn zed_version_string(&self) -> String;
fn launch(&self, ipc_url: String) -> anyhow::Result<()>;
fn run_foreground(&self, ipc_url: String) -> io::Result<ExitStatus>;
fn path(&self) -> PathBuf;
}
#[derive(Parser, Debug)]
@ -73,6 +74,10 @@ struct Args {
/// Run zed in dev-server mode
#[arg(long)]
dev_server_token: Option<String>,
/// Not supported in Zed CLI, only supported on Zed binary
/// Will attempt to give the correct command to run
#[arg(long)]
system_specs: bool,
/// Uninstall Zed from user system
#[cfg(all(
any(target_os = "linux", target_os = "macos"),
@ -140,6 +145,16 @@ fn main() -> Result<()> {
return Ok(());
}
if args.system_specs {
let path = app.path();
let msg = [
"The `--system-specs` argument is not supported in the Zed CLI, only on Zed binary.",
"To retrieve the system specs on the command line, run the following command:",
&format!("{} --system-specs", path.display()),
];
return Err(anyhow::anyhow!(msg.join("\n")));
}
#[cfg(all(
any(target_os = "linux", target_os = "macos"),
not(feature = "no-bundled-uninstall")
@ -437,6 +452,10 @@ mod linux {
.arg(ipc_url)
.status()
}
fn path(&self) -> PathBuf {
self.0.clone()
}
}
impl App {
@ -674,6 +693,10 @@ mod windows {
.spawn()?
.wait()
}
fn path(&self) -> PathBuf {
self.0.clone()
}
}
impl Detect {
@ -876,6 +899,13 @@ mod mac_os {
std::process::Command::new(path).arg(ipc_url).status()
}
fn path(&self) -> PathBuf {
match self {
Bundle::App { app_bundle, .. } => app_bundle.join("Contents/MacOS/zed").clone(),
Bundle::LocalPath { executable, .. } => executable.clone(),
}
}
}
impl Bundle {