Refactor command location and DevChat installation
- Updated the locateCommand function to split the output of the 'where' and 'which' commands and return the first line. - Modified the DevChat installation command to include the path in quotes to handle paths with spaces.
This commit is contained in:
parent
e6f184cfe6
commit
e53b0576b3
@ -9,10 +9,13 @@ let devchatStatus = '';
|
||||
|
||||
function locateCommand(command): string | undefined {
|
||||
try {
|
||||
return runCommand(`where ${command}`).toString().trim();
|
||||
// split lines and choose first line
|
||||
const binPaths = runCommand(`where ${command}`).toString().trim().split('\n');
|
||||
return binPaths[0].trim();
|
||||
} catch (error) {
|
||||
try {
|
||||
return runCommand(`which ${command}`).toString().trim();
|
||||
const binPaths = runCommand(`which ${command}`).toString().trim().split('\n');
|
||||
return binPaths[0].trim();
|
||||
} catch (error) {
|
||||
return undefined;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ export async function dependencyCheck(): Promise<[string, string]> {
|
||||
}
|
||||
if (devchatStatus === 'not ready') {
|
||||
// auto install devchat
|
||||
UiUtilWrapper.runTerminal('DevChat Install', `${pythonCommand} ${UiUtilWrapper.extensionPath() + "/tools/install.py"}`);
|
||||
UiUtilWrapper.runTerminal('DevChat Install', `${pythonCommand} "${UiUtilWrapper.extensionPath() + "/tools/install.py"}"`);
|
||||
devchatStatus = 'Waiting for devchat installation to complete';
|
||||
isVersionChangeCompare = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user