Skip to content

Windows: git probes via execSync flash a console window (missing windowsHide) #105

Description

@xxmisaoxx

Summary

On Windows, the plugin's git-discovery helpers in src/services/tags.ts call execSync("git ...") without windowsHide: true. Because the plugin runs inside OpenCode's console-less background service process (opencode-cli serve --service), each call allocates a new visible console window (cmd.exe) that flashes and steals focus from the app.

Environment

  • opencode-supermemory: 2.0.15 (current latest on npm)
  • OpenCode: Desktop 2.0.24 (bundled opencode-cli 2.0.24)
  • OS: Windows 10 Pro, build 19045 (win32 x64)
  • Shell / default terminal: cmd.exe / Windows Console Host

Reproduction

  1. Windows + OpenCode Desktop with this plugin enabled, in a git working copy.
  2. Use sessions normally (the flashes also happen when project "location services" boot).
  3. Observe bursts of cmd.exe windows flashing and stealing focus.

Evidence

Process monitor (parent chain + command lines) captured during a single ~17 s burst:

  • 53 × cmd.exe with parent opencode-cli.exe serve --service
  • 46 of them were cmd.exe /d /s /c "git ..."
  • 56 × git.exe children

Command lines captured (they match the helpers in src/services/tags.ts exactly):

cmd.exe /d /s /c "git rev-parse --git-common-dir"
cmd.exe /d /s /c "git rev-parse --show-toplevel"
cmd.exe /d /s /c "git config user.email"
cmd.exe /d /s /c "git remote get-url origin"

Root cause

On Windows, a child process spawned by a console-less parent gets a new visible console unless it is created with CREATE_NO_WINDOW. Node maps windowsHide: true to CREATE_NO_WINDOW. execSync runs through a shell, so on Windows it spawns cmd.exe /d /s /c, and without windowsHide that cmd.exe gets a visible console window.

Relevant call sites (dist/index.js, source src/services/tags.ts):

execSync("git rev-parse --git-common-dir", { cwd: directory, encoding: "utf-8", stdio: ["pipe","pipe","pipe"] });
execSync("git rev-parse --show-toplevel",  { cwd: directory, encoding: "utf-8", stdio: ["pipe","pipe","pipe"] });
execSync("git config user.email",           { cwd: base,      encoding: "utf-8", stdio: ["pipe","pipe","pipe"] });
execSync("git remote get-url origin",       { cwd: directory, encoding: "utf-8", stdio: ["pipe","pipe","pipe"] });

Note: dist/cli.js already passes { windowsHide: true } in one execFile call, so the option is known in the codebase but missing on these git helpers.

Suggested fix

Add windowsHide: true to every execSync / child_process call that spawns a process (the git helpers above, plus any other spawn sites). Optionally, avoid execSync for git since it is a native .exe and needs no shell. This removes the flashing on Windows without affecting macOS/Linux.

Related

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions