mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Add tests for core/utils/editor (#851)
This commit is contained in:
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user