Skip to content

Port upstream PR #329: Hide CLI console window on Windows #27

@github-actions

Description

@github-actions

Upstream Change

Upstream PR github/copilot-sdk#329 adds automatic hiding of the CLI console window on Windows when spawning the CLI subprocess. This prevents a distracting terminal window appearing in GUI applications.

Node.js change (nodejs/src/client.ts):

this.cliProcess = spawn(command, spawnArgs, {
    stdio: ...,
    cwd: this.options.cwd,
    env: envWithoutNodeDebug,
    windowsHide: true,  // <-- added
});

Why Not Auto-Ported

The Clojure SDK uses Java's ProcessBuilder to spawn the CLI process (src/github/copilot_sdk/process.clj). Unlike Node.js's spawn which has a built-in windowsHide option, ProcessBuilder does not support hiding the Windows console window natively.

Options to port this to JVM:

  1. JNA (Java Native Access) — Add a JNA dependency and call Windows CreateProcess directly with CREATE_NO_WINDOW. This adds a native dependency but works cleanly.

  2. Reflection into ProcessImpl — Fragile, not recommended.

  3. Accept as JVM limitation — Document that on Windows, a console window may briefly appear. The SDK primarily targets server-side use cases where this is less of a concern.

  4. ProcessBuilder.inheritIO() + redirects — Doesn't help with window visibility.

Recommendation

If the Clojure SDK targets Windows GUI applications, option 1 (JNA) is the cleanest approach. Otherwise, document the limitation.

The relevant Clojure file to modify is src/github/copilot_sdk/process.clj, specifically the spawn-cli function (lines 29-88).

Affected Upstream Files

  • nodejs/src/client.tswindowsHide: true in both stdio and TCP spawn calls
  • python/copilot/client.pyCREATE_NO_WINDOW flag on Windows
  • go/client.go + go/process_windows.go — platform-specific SysProcAttr.HideWindow

Testing

After implementing, verify that on Windows, no console window appears when using the SDK from a GUI application (e.g., a JavaFX or Swing app).

Generated by Upstream Sync Agent

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions