From e38f0b64da95b9b7415bd57557c593fd633355db Mon Sep 17 00:00:00 2001 From: leonvchan Date: Thu, 1 Oct 2026 20:06:54 +0800 Subject: [PATCH] fix: pass windowsHide to the git execSync calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `execSync` with a string command runs through `cmd.exe` on Windows, and `windowsHide` defaults to false, so the child process is created with a console window whenever the caller has no console of its own — which is the case for the OpenCode service process. A newly created console window takes foreground focus, which breaks IME composition while a session is in use. The CLI entrypoint already passes `windowsHide: true`; these six call sites in `src/services/tags.ts` did not. `stdio: ["pipe", "pipe", "pipe"]` does not suppress the window on Windows — only `windowsHide` does. Fixes #101 --- src/services/tags.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/services/tags.ts b/src/services/tags.ts index be26c57..e520f10 100644 --- a/src/services/tags.ts +++ b/src/services/tags.ts @@ -23,6 +23,7 @@ function getGitRoot(directory: string): string | null { cwd: directory, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], + windowsHide: true, }).trim(); return gitRoot || null; } @@ -31,6 +32,7 @@ function getGitRoot(directory: string): string | null { cwd: directory, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], + windowsHide: true, }).trim(); if (gitCommonDir === ".git") { @@ -38,6 +40,7 @@ function getGitRoot(directory: string): string | null { cwd: directory, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], + windowsHide: true, }).trim(); return gitRoot || null; } @@ -51,6 +54,7 @@ function getGitRoot(directory: string): string | null { cwd: directory, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], + windowsHide: true, }).trim(); return gitRoot || null; } catch { @@ -68,6 +72,7 @@ function getGitEmail(directory: string): string | null { cwd: getProjectBasePath(directory), encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], + windowsHide: true, }).trim(); return email || null; } catch { @@ -120,6 +125,7 @@ function getGitRepoInfo(directory: string): { cwd: directory, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"], + windowsHide: true, }).trim(); const normalizedRemote = normalizeGitRemote(remoteUrl); const displayRemote = remoteUrl.replace(/\/+$/, "").replace(/\.git$/i, "");