windows: Set CREATE_NO_WINDOW
for commands (#18447)
- Closes: #18371 Release Notes: - N/A
This commit is contained in:
parent
49ed932c1f
commit
95ace03706
31 changed files with 122 additions and 174 deletions
|
@ -19,12 +19,9 @@ use serde_json::{json, value::RawValue, Value};
|
|||
use smol::{
|
||||
channel,
|
||||
io::{AsyncBufReadExt, AsyncWriteExt, BufReader},
|
||||
process::{self, Child},
|
||||
process::Child,
|
||||
};
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
use smol::process::windows::CommandExt;
|
||||
|
||||
use std::{
|
||||
ffi::{OsStr, OsString},
|
||||
fmt,
|
||||
|
@ -346,23 +343,21 @@ impl LanguageServer {
|
|||
&binary.arguments
|
||||
);
|
||||
|
||||
let mut command = process::Command::new(&binary.path);
|
||||
command
|
||||
let mut server = util::command::new_smol_command(&binary.path)
|
||||
.current_dir(working_dir)
|
||||
.args(&binary.arguments)
|
||||
.envs(binary.env.unwrap_or_default())
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.kill_on_drop(true);
|
||||
#[cfg(windows)]
|
||||
command.creation_flags(windows::Win32::System::Threading::CREATE_NO_WINDOW.0);
|
||||
let mut server = command.spawn().with_context(|| {
|
||||
format!(
|
||||
"failed to spawn command. path: {:?}, working directory: {:?}, args: {:?}",
|
||||
binary.path, working_dir, &binary.arguments
|
||||
)
|
||||
})?;
|
||||
.kill_on_drop(true)
|
||||
.spawn()
|
||||
.with_context(|| {
|
||||
format!(
|
||||
"failed to spawn command. path: {:?}, working directory: {:?}, args: {:?}",
|
||||
binary.path, working_dir, &binary.arguments
|
||||
)
|
||||
})?;
|
||||
|
||||
let stdin = server.stdin.take().unwrap();
|
||||
let stdout = server.stdout.take().unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue