fix(web): hide daemon/git console windows on Windows (#653)

This commit is contained in:
Sergio
2026-03-13 11:13:36 +02:00
committed by GitHub
parent 9fb7c90dbd
commit 875491c438
3 changed files with 8 additions and 3 deletions
+1
View File
@@ -2731,6 +2731,7 @@ const commands = {
const child = spawn(runtimeBin, serverArgs, { const child = spawn(runtimeBin, serverArgs, {
detached: true, detached: true,
windowsHide: true,
stdio: ['ignore', logFd, logFd, 'ipc'], stdio: ['ignore', logFd, logFd, 'ipc'],
env: { env: {
...process.env, ...process.env,
+3 -1
View File
@@ -564,6 +564,7 @@ const searchFilesystemFiles = async (rootPath, options) => {
const result = await new Promise((resolve) => { const result = await new Promise((resolve) => {
const child = spawn('git', ['check-ignore', '--', ...pathsToCheck], { const child = spawn('git', ['check-ignore', '--', ...pathsToCheck], {
cwd: dir, cwd: dir,
windowsHide: true,
stdio: ['ignore', 'pipe', 'pipe'], stdio: ['ignore', 'pipe', 'pipe'],
}); });
@@ -1135,7 +1136,7 @@ const buildTemplateVariables = async (payload, sessionId) => {
if (worktreeDir) { if (worktreeDir) {
try { try {
const { simpleGit } = await import('simple-git'); const { simpleGit } = await import('simple-git');
const git = simpleGit(worktreeDir); const git = simpleGit({ baseDir: worktreeDir, spawnOptions: { windowsHide: true } });
branch = await Promise.race([ branch = await Promise.race([
git.revparse(['--abbrev-ref', 'HEAD']), git.revparse(['--abbrev-ref', 'HEAD']),
new Promise((_, reject) => setTimeout(() => reject(new Error('git timeout')), 3000)), new Promise((_, reject) => setTimeout(() => reject(new Error('git timeout')), 3000)),
@@ -12950,6 +12951,7 @@ async function main(options = {}) {
const result = await new Promise((resolve) => { const result = await new Promise((resolve) => {
const child = spawn('git', ['check-ignore', '--', ...pathsToCheck], { const child = spawn('git', ['check-ignore', '--', ...pathsToCheck], {
cwd: resolvedPath, cwd: resolvedPath,
windowsHide: true,
stdio: ['ignore', 'pipe', 'pipe'], stdio: ['ignore', 'pipe', 'pipe'],
}); });
+4 -2
View File
@@ -125,10 +125,11 @@ const buildGitEnv = async () => {
const createGit = async (directory) => { const createGit = async (directory) => {
const env = await buildGitEnv(); const env = await buildGitEnv();
const spawnOptions = { windowsHide: true };
if (!directory) { if (!directory) {
return simpleGit({ env }); return simpleGit({ env, spawnOptions });
} }
return simpleGit({ baseDir: normalizeDirectoryPath(directory), env }); return simpleGit({ baseDir: normalizeDirectoryPath(directory), env, spawnOptions });
}; };
const normalizeDirectoryPath = (value) => { const normalizeDirectoryPath = (value) => {
@@ -415,6 +416,7 @@ const runGitCommand = async (cwd, args) => {
const { stdout, stderr } = await execFileAsync('git', args, { const { stdout, stderr } = await execFileAsync('git', args, {
cwd, cwd,
env: await buildGitEnv(), env: await buildGitEnv(),
windowsHide: true,
maxBuffer: 20 * 1024 * 1024, maxBuffer: 20 * 1024 * 1024,
}); });
return { return {