diff --git a/v3/@claude-flow/cli/src/commands/doctor.ts b/v3/@claude-flow/cli/src/commands/doctor.ts index d22d80a261..9f7b8c607f 100644 --- a/v3/@claude-flow/cli/src/commands/doctor.ts +++ b/v3/@claude-flow/cli/src/commands/doctor.ts @@ -152,24 +152,20 @@ async function checkApiKeys(): Promise { } } -// Check git (async) +// Check git (async with proper env inheritance) async function checkGit(): Promise { try { - const { promisify } = require('util'); - const execAsync = promisify(require('child_process').exec); - const { stdout } = await execAsync('git --version', { encoding: 'utf8', timeout: 5000 }); - return { name: 'Git', status: 'pass', message: stdout.trim().replace('git version ', 'v') }; + const version = await runCommand('git --version'); + return { name: 'Git', status: 'pass', message: version.replace('git version ', 'v') }; } catch { return { name: 'Git', status: 'warn', message: 'Not installed', fix: 'Install git from https://git-scm.com' }; } } -// Check if in git repo (async) +// Check if in git repo (async with proper env inheritance) async function checkGitRepo(): Promise { try { - const { promisify } = require('util'); - const execAsync = promisify(require('child_process').exec); - await execAsync('git rev-parse --git-dir', { encoding: 'utf8', timeout: 5000 }); + await runCommand('git rev-parse --git-dir'); return { name: 'Git Repository', status: 'pass', message: 'In a git repository' }; } catch { return { name: 'Git Repository', status: 'warn', message: 'Not a git repository', fix: 'git init' };