mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-14 07:10:34 -07:00
refactor: Replace exec with spawn (#8510)
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
import * as fs from 'node:fs/promises';
|
||||
import * as path from 'node:path';
|
||||
import { isNodeError } from '../utils/errors.js';
|
||||
import { exec } from 'node:child_process';
|
||||
import { spawnAsync } from '../utils/shell-utils.js';
|
||||
import type { SimpleGit } from 'simple-git';
|
||||
import { simpleGit, CheckRepoActions } from 'simple-git';
|
||||
import type { Storage } from '../config/storage.js';
|
||||
@@ -41,16 +41,13 @@ export class GitService {
|
||||
}
|
||||
}
|
||||
|
||||
verifyGitAvailability(): Promise<boolean> {
|
||||
return new Promise((resolve) => {
|
||||
exec('git --version', (error) => {
|
||||
if (error) {
|
||||
resolve(false);
|
||||
} else {
|
||||
resolve(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
async verifyGitAvailability(): Promise<boolean> {
|
||||
try {
|
||||
await spawnAsync('git', ['--version']);
|
||||
return true;
|
||||
} catch (_error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user