Skip to content

fix(desktop): hide terminal window when opening explorer on Windows (#2309) - #2316

Open
Dewin wants to merge 1 commit into
CapSoftware:mainfrom
Dewin:fix/open-file-hide-window-2309
Open

Dewin wants to merge 1 commit into
CapSoftware:mainfrom
Dewin:fix/open-file-hide-window-2309

Conversation

@Dewin

@Dewin Dewin commented Sep 18, 2026

Copy link
Copy Markdown

What does this PR do?

Resolves #2309 (Linear CAP-814) where clicking "Open File" after an export on Windows flashes a visible console/terminal window.

Root Cause

When spawning explorer.exe on Windows via std::process::Command, Windows defaults to allocating a temporary console window for the process unless the CREATE_NO_WINDOW process creation flag is explicitly set.

Solution

  • Set creation_flags(CREATE_NO_WINDOW) (0x0800_0000) using std::os::windows::process::CommandExt on Command::new("explorer") calls in:
    • apps/desktop/src-tauri/src/lib.rs (open_file_path)
    • apps/desktop-gpui/src/library.rs (reveal_in_folder)
    • apps/desktop/src-tauri/src/automation.rs (reveal_path)
    • apps/cli/src/automation.rs (open_path_or_url)

Verification

  • Verified consistent usage of CREATE_NO_WINDOW: u32 = 0x0800_0000 matching existing pattern in apps/desktop/src-tauri/src/export.rs.
  • Checked argument formatting and execution paths on Windows.

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with no actionable correctness, security, or repository-rule issues identified.

Summary

This PR suppresses transient Windows console windows when Cap launches Explorer from desktop, GPUI, desktop automation, and CLI automation paths.

  • Adds the Windows CREATE_NO_WINDOW creation flag to all direct Explorer process launches.
  • Preserves the existing paths, arguments, process spawning, and platform-specific behavior.
  • Keeps the Windows-only API imports behind target-specific compilation gates.

Reviews (1) · Last reviewed commit: "fix(desktop): hide terminal window when ..."

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Export complete | Clicking 'Open File' causes a visible terminal window

1 participant