fix(web): hide daemon/git console windows on Windows (#653)
This commit is contained in:
@@ -2731,6 +2731,7 @@ const commands = {
|
||||
|
||||
const child = spawn(runtimeBin, serverArgs, {
|
||||
detached: true,
|
||||
windowsHide: true,
|
||||
stdio: ['ignore', logFd, logFd, 'ipc'],
|
||||
env: {
|
||||
...process.env,
|
||||
|
||||
@@ -564,6 +564,7 @@ const searchFilesystemFiles = async (rootPath, options) => {
|
||||
const result = await new Promise((resolve) => {
|
||||
const child = spawn('git', ['check-ignore', '--', ...pathsToCheck], {
|
||||
cwd: dir,
|
||||
windowsHide: true,
|
||||
stdio: ['ignore', 'pipe', 'pipe'],
|
||||
});
|
||||
|
||||
@@ -1135,7 +1136,7 @@ const buildTemplateVariables = async (payload, sessionId) => {
|
||||
if (worktreeDir) {
|
||||
try {
|
||||
const { simpleGit } = await import('simple-git');
|
||||
const git = simpleGit(worktreeDir);
|
||||
const git = simpleGit({ baseDir: worktreeDir, spawnOptions: { windowsHide: true } });
|
||||
branch = await Promise.race([
|
||||
git.revparse(['--abbrev-ref', 'HEAD']),
|
||||
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 child = spawn('git', ['check-ignore', '--', ...pathsToCheck], {
|
||||
cwd: resolvedPath,
|
||||
windowsHide: true,
|
||||
stdio: ['ignore', 'pipe', 'pipe'],
|
||||
});
|
||||
|
||||
|
||||
@@ -125,10 +125,11 @@ const buildGitEnv = async () => {
|
||||
|
||||
const createGit = async (directory) => {
|
||||
const env = await buildGitEnv();
|
||||
const spawnOptions = { windowsHide: true };
|
||||
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) => {
|
||||
@@ -415,6 +416,7 @@ const runGitCommand = async (cwd, args) => {
|
||||
const { stdout, stderr } = await execFileAsync('git', args, {
|
||||
cwd,
|
||||
env: await buildGitEnv(),
|
||||
windowsHide: true,
|
||||
maxBuffer: 20 * 1024 * 1024,
|
||||
});
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user