diff --git a/extension/src/cli/dvc/discovery.ts b/extension/src/cli/dvc/discovery.ts index c427cf2820..5a1b34fb64 100644 --- a/extension/src/cli/dvc/discovery.ts +++ b/extension/src/cli/dvc/discovery.ts @@ -127,10 +127,16 @@ const tryGlobalFallbackVersion = async ( const tryGlobal = await getVersionDetails(setup, cwd, true) const { cliCompatible, isAvailable, isCompatible, version } = tryGlobal - if (isCompatible) { - setup.unsetPythonBinPath() + if (!isCompatible) { + return { + isAvailable, + isCompatible, + version + } } + setup.unsetPythonBinPath() + return processVersionDetails( setup, cliCompatible, @@ -152,7 +158,11 @@ const extensionCanAutoRunCli = async ( } = await getVersionDetails(setup, cwd) if (pythonCliCompatible === CliCompatible.NO_NOT_FOUND) { - return tryGlobalFallbackVersion(setup, cwd) + const globalResults = await tryGlobalFallbackVersion(setup, cwd) + + if (globalResults.isCompatible) { + return globalResults + } } return processVersionDetails( diff --git a/extension/src/setup/runner.test.ts b/extension/src/setup/runner.test.ts index 3e4c73642c..bb86861afb 100644 --- a/extension/src/setup/runner.test.ts +++ b/extension/src/setup/runner.test.ts @@ -485,8 +485,9 @@ describe('run', () => { await flushPromises() expect(mockedWarnWithOptions).toHaveBeenCalledTimes(1) expect(mockedWarnWithOptions).toHaveBeenCalledWith( - 'The extension cannot initialize because the DVC CLI version is incompatible.', - Response.SHOW_SETUP + 'An error was thrown when trying to access the CLI.', + Response.SHOW_SETUP, + Response.NEVER ) expect(mockedGetCliVersion).toHaveBeenCalledTimes(2) expect(mockedResetMembers).toHaveBeenCalledTimes(1)