windows: Prevent command line from opening in release mode (#9839)
Release Notes: - Prevents the terminal from opening on release mode on Windows Note: this also prevents Zed from logging to the terminal when it is launched from the terminal. Is this expected behaviour on other platforms? --------- Co-authored-by: 白山風露 <shirayama.kazatsuyu@gmail.com>
This commit is contained in:
+10
-3
@@ -15,6 +15,10 @@ use smol::{
|
||||
io::{AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader},
|
||||
process::{self, Child},
|
||||
};
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
use smol::process::windows::CommandExt;
|
||||
|
||||
use std::{
|
||||
ffi::OsString,
|
||||
fmt,
|
||||
@@ -215,15 +219,18 @@ impl LanguageServer {
|
||||
&binary.arguments
|
||||
);
|
||||
|
||||
let mut server = process::Command::new(&binary.path)
|
||||
let mut command = process::Command::new(&binary.path);
|
||||
command
|
||||
.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)
|
||||
.spawn()?;
|
||||
.kill_on_drop(true);
|
||||
#[cfg(windows)]
|
||||
command.creation_flags(windows::Win32::System::Threading::CREATE_NO_WINDOW.0);
|
||||
let mut server = command.spawn()?;
|
||||
|
||||
let stdin = server.stdin.take().unwrap();
|
||||
let stdout = server.stdout.take().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user