Skip to content

Commit 7bd3544

Browse files
authored
cli: fix windows service-mode not working (microsoft#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.
1 parent d441153 commit 7bd3544

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cli/src/tunnels/code_server.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,17 @@ impl<'a> ServerBuilder<'a> {
566566
}
567567

568568
fn get_base_command(&self) -> Command {
569+
#[cfg(not(windows))]
569570
let mut cmd = Command::new(&self.server_paths.executable);
571+
#[cfg(windows)]
572+
let mut cmd = {
573+
let mut cmd = Command::new("cmd");
574+
cmd.arg("/Q");
575+
cmd.arg("/C");
576+
cmd.arg(&self.server_paths.executable);
577+
cmd
578+
};
579+
570580
cmd.stdin(std::process::Stdio::null())
571581
.args(self.server_params.code_server_args.command_arguments());
572582
cmd

0 commit comments

Comments
 (0)