windows: Set CREATE_NO_WINDOW for commands (#18447)

- Closes: #18371

Release Notes:

- N/A
This commit is contained in:
张小白 2024-11-21 08:52:38 +08:00 committed by GitHub
parent 49ed932c1f
commit 95ace03706
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 122 additions and 174 deletions

View file

@ -32,9 +32,6 @@ ui.workspace = true
unicode-segmentation.workspace = true
util.workspace = true
[target.'cfg(target_os = "windows")'.dependencies]
windows.workspace = true
[dev-dependencies]
editor = { workspace = true, features = ["test-support"] }
env_logger.workspace = true

View file

@ -21,7 +21,7 @@ use serde::{Deserialize, Serialize};
use settings::SettingsStore;
use smol::{
io::AsyncWriteExt,
process::{Child, ChildStdin, ChildStdout, Command},
process::{Child, ChildStdin, ChildStdout},
};
use std::{path::PathBuf, process::Stdio, sync::Arc};
use ui::prelude::*;
@ -269,21 +269,14 @@ impl SupermavenAgent {
client: Arc<Client>,
cx: &mut ModelContext<Supermaven>,
) -> Result<Self> {
let mut process = Command::new(&binary_path);
process
let mut process = util::command::new_smol_command(&binary_path)
.arg("stdio")
.stdin(Stdio::piped())
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.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")?;
.kill_on_drop(true)
.spawn()
.context("failed to start the binary")?;
let stdin = process
.stdin