Add tests for core/utils/editor (#851)

This commit is contained in:
Eddie Santos 2025-06-08 12:42:42 -07:00 committed by GitHub
parent 241c404573
commit 394312b9c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 126 additions and 9 deletions

View file

@ -13,16 +13,16 @@ interface DiffCommand {
args: string[];
}
export function checkHasEditor(editor: EditorType): boolean {
const commandExists = (cmd: string): boolean => {
try {
execSync(`which ${cmd}`, { stdio: 'ignore' });
return true;
} catch {
return false;
}
};
function commandExists(cmd: string): boolean {
try {
execSync(`which ${cmd}`, { stdio: 'ignore' });
return true;
} catch {
return false;
}
}
export function checkHasEditor(editor: EditorType): boolean {
if (editor === 'vscode') {
return commandExists('code');
} else if (editor === 'vim') {