diff --git a/go/client.go b/go/client.go index 4db0f02c..d383d977 100644 --- a/go/client.go +++ b/go/client.go @@ -1056,6 +1056,9 @@ func (c *Client) startCLIServer(ctx context.Context) error { c.process = exec.CommandContext(ctx, command, args...) + // Configure platform-specific process attributes (e.g., hide window on Windows) + configureProcAttr(c.process) + // Set working directory if specified if c.options.Cwd != "" { c.process.Dir = c.options.Cwd diff --git a/go/process_other.go b/go/process_other.go new file mode 100644 index 00000000..5b3ba635 --- /dev/null +++ b/go/process_other.go @@ -0,0 +1,11 @@ +//go:build !windows + +package copilot + +import "os/exec" + +// configureProcAttr configures platform-specific process attributes. +// On non-Windows platforms, this is a no-op. +func configureProcAttr(cmd *exec.Cmd) { + // No special configuration needed on non-Windows platforms +} diff --git a/go/process_windows.go b/go/process_windows.go new file mode 100644 index 00000000..37f954fc --- /dev/null +++ b/go/process_windows.go @@ -0,0 +1,16 @@ +//go:build windows + +package copilot + +import ( + "os/exec" + "syscall" +) + +// configureProcAttr configures platform-specific process attributes. +// On Windows, this hides the console window to avoid distracting users in GUI apps. +func configureProcAttr(cmd *exec.Cmd) { + cmd.SysProcAttr = &syscall.SysProcAttr{ + HideWindow: true, + } +} diff --git a/nodejs/src/client.ts b/nodejs/src/client.ts index 3dc61c44..50764363 100644 --- a/nodejs/src/client.ts +++ b/nodejs/src/client.ts @@ -1053,12 +1053,14 @@ export class CopilotClient { stdio: stdioConfig, cwd: this.options.cwd, env: envWithoutNodeDebug, + windowsHide: true, }); } else { this.cliProcess = spawn(this.options.cliPath, args, { stdio: stdioConfig, cwd: this.options.cwd, env: envWithoutNodeDebug, + windowsHide: true, }); } diff --git a/python/copilot/client.py b/python/copilot/client.py index 11669ddc..03be8ca1 100644 --- a/python/copilot/client.py +++ b/python/copilot/client.py @@ -1167,6 +1167,9 @@ async def _start_cli_server(self) -> None: if self.options.get("github_token"): env["COPILOT_SDK_AUTH_TOKEN"] = self.options["github_token"] + # On Windows, hide the console window to avoid distracting users in GUI apps + creationflags = subprocess.CREATE_NO_WINDOW if sys.platform == "win32" else 0 + # Choose transport mode if self.options["use_stdio"]: args.append("--stdio") @@ -1179,6 +1182,7 @@ async def _start_cli_server(self) -> None: bufsize=0, cwd=self.options["cwd"], env=env, + creationflags=creationflags, ) else: if self.options["port"] > 0: @@ -1190,6 +1194,7 @@ async def _start_cli_server(self) -> None: stderr=subprocess.PIPE, cwd=self.options["cwd"], env=env, + creationflags=creationflags, ) # For stdio mode, we're ready immediately