Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions go/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions go/process_other.go
Original file line number Diff line number Diff line change
@@ -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
}
16 changes: 16 additions & 0 deletions go/process_windows.go
Original file line number Diff line number Diff line change
@@ -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,
}
}
2 changes: 2 additions & 0 deletions nodejs/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}

Expand Down
5 changes: 5 additions & 0 deletions python/copilot/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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:
Expand All @@ -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
Expand Down
Loading