Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
windows: Fix supermaven (#16203)
张小白88a12b60a98f
diff --git a/Cargo.lock b/Cargo.lockindex 7d847d41ccc..54b53889dd8 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -10509,6 +10509,7 @@ dependencies = ["theme","ui","util",+ "windows 0.58.0",][[package]]diff --git a/crates/supermaven/Cargo.toml b/crates/supermaven/Cargo.tomlindex af9d619a436..b8f85c0f056 100644--- a/crates/supermaven/Cargo.toml+++ b/crates/supermaven/Cargo.toml@@ -31,6 +31,9 @@ text.workspace = trueui.workspace = trueutil.workspace = true+[target.'cfg(target_os = "windows")'.dependencies]+windows.workspace = true+[dev-dependencies]editor = { workspace = true, features = ["test-support"] }env_logger.workspace = truediff --git a/crates/supermaven/src/supermaven.rs b/crates/supermaven/src/supermaven.rsindex e0ebb31cf63..c3bc96d9f86 100644--- a/crates/supermaven/src/supermaven.rs+++ b/crates/supermaven/src/supermaven.rs@@ -260,14 +260,21 @@ impl SupermavenAgent {client: Arc<Client>,cx: &mut ModelContext<Supermaven>,) -> Result<Self> {- let mut process = Command::new(&binary_path)+ let mut process = Command::new(&binary_path);+ process.arg("stdio").stdin(Stdio::piped()).stdout(Stdio::piped()).stderr(Stdio::piped())- .kill_on_drop(true)- .spawn()- .context("failed to start the binary")?;+ .kill_on_drop(true);++ #[cfg(target_os = "windows")]+ {+ use smol::process::windows::CommandExt;+ process.creation_flags(windows::Win32::System::Threading::CREATE_NO_WINDOW.0);+ }++ let mut process = process.spawn().context("failed to start the binary")?;let stdin = process.stdindiff --git a/crates/supermaven_api/src/supermaven_api.rs b/crates/supermaven_api/src/supermaven_api.rsindex b341c2c23ca..20c1214e36b 100644--- a/crates/supermaven_api/src/supermaven_api.rs+++ b/crates/supermaven_api/src/supermaven_api.rs@@ -212,7 +212,11 @@ pub async fn latest_release(}pub fn version_path(version: u64) -> PathBuf {- supermaven_dir().join(format!("sm-agent-{}", version))+ supermaven_dir().join(format!(+ "sm-agent-{}{}",+ version,+ std::env::consts::EXE_SUFFIX+ ))}pub async fn has_version(version_path: &Path) -> bool {