cli: spawn code_serer with CREATE_NO_WINDOW (#189477)

* fix: spawn code_serer with CREATE_NO_WINDOW

fixes #184058

* use winapi constant instead

---------

Co-authored-by: Connor Peet <connor@peet.io>
This commit is contained in:
Connor Peet 2023-08-03 11:16:12 -07:00 committed by GitHub
commit 62ce95cda1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -541,6 +541,15 @@ impl<'a> ServerBuilder<'a> {
debug!(self.logger, "Starting server with command... {:?}", cmd);
// On Windows spawning a code-server binary will run cmd.exe /c C:\path\to\code-server.cmd...
// This spawns a cmd.exe window for the user, which if they close will kill the code-server process
// and disconnect the tunnel. To prevent this, pass the CREATE_NO_WINDOW flag to the Command
// only on Windows.
// Original issue: https://github.com/microsoft/vscode/issues/184058
// Partial fix: https://github.com/microsoft/vscode/pull/184621
#[cfg(target_os = "windows")]
let cmd = cmd.creation_flags(winapi::um::winbase::CREATE_NO_WINDOW);
let child = cmd
.stderr(std::process::Stdio::piped())
.stdout(std::process::Stdio::piped())