mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
fix: suppress git stderr when running in non-git directory
This commit is contained in:
@@ -86,7 +86,11 @@ function readWorktreeFromGit(): WorktreeInfo | null {
|
||||
|
||||
function runGit(args: string[], cwd: string): string | null {
|
||||
try {
|
||||
const output = execFileSync('git', args, { cwd, encoding: 'utf8' }).trim();
|
||||
const output = execFileSync('git', args, {
|
||||
cwd,
|
||||
encoding: 'utf8',
|
||||
stdio: ['ignore', 'pipe', 'ignore']
|
||||
}).trim();
|
||||
return output.length > 0 ? output : null;
|
||||
} catch {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user