cli: fix windows service-mode not working (#187883)

It seems like we need to run the server (a batch file) with cmd explicitly when the server itself is not run from a command prompt.
This commit is contained in:
Connor Peet
2023-07-13 18:04:19 -07:00
committed by GitHub
parent d441153e31
commit 7bd35446a5

View File

@@ -566,7 +566,17 @@ impl<'a> ServerBuilder<'a> {
}
fn get_base_command(&self) -> Command {
#[cfg(not(windows))]
let mut cmd = Command::new(&self.server_paths.executable);
#[cfg(windows)]
let mut cmd = {
let mut cmd = Command::new("cmd");
cmd.arg("/Q");
cmd.arg("/C");
cmd.arg(&self.server_paths.executable);
cmd
};
cmd.stdin(std::process::Stdio::null())
.args(self.server_params.code_server_args.command_arguments());
cmd