mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
fix(pyenv): identify shims correctly
Some checks failed
Azure Static Web Apps CI/CD / Build and Deploy (push) Has been cancelled
Release / changelog (push) Has been cancelled
Release / artifacts (push) Has been cancelled
Release / msi (arm64) (push) Has been cancelled
Release / msi (x64) (push) Has been cancelled
Release / msi (x86) (push) Has been cancelled
Release / release (push) Has been cancelled
Some checks failed
Azure Static Web Apps CI/CD / Build and Deploy (push) Has been cancelled
Release / changelog (push) Has been cancelled
Release / artifacts (push) Has been cancelled
Release / msi (arm64) (push) Has been cancelled
Release / msi (x64) (push) Has been cancelled
Release / msi (x86) (push) Has been cancelled
Release / release (push) Has been cancelled
This commit is contained in:
parent
58670c5a80
commit
a66586da69
|
@ -222,12 +222,14 @@ func (l *language) setVersion() error {
|
||||||
for _, command := range l.commands {
|
for _, command := range l.commands {
|
||||||
versionStr, err := l.runCommand(command)
|
versionStr, err := l.runCommand(command)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Error(err)
|
||||||
lastError = err
|
lastError = err
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
version, err := command.parse(versionStr)
|
version, err := command.parse(versionStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Error(err)
|
||||||
lastError = fmt.Errorf("err parsing info from %s with %s", command.executable, versionStr)
|
lastError = fmt.Errorf("err parsing info from %s with %s", command.executable, versionStr)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -271,8 +273,12 @@ func (l *language) runCommand(command *cmd) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
versionStr, err := command.getVersion()
|
versionStr, err := command.getVersion()
|
||||||
if err != nil || versionStr == "" {
|
if err != nil {
|
||||||
return "", errors.New("cannot get version")
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(versionStr) == 0 {
|
||||||
|
return "", errors.New("no version found")
|
||||||
}
|
}
|
||||||
|
|
||||||
return versionStr, nil
|
return versionStr, nil
|
||||||
|
|
|
@ -138,8 +138,7 @@ func (p *Python) pyenvVersion() (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pyEnvRoot := p.env.Getenv("PYENV_ROOT")
|
pyEnvRoot := p.env.Getenv("PYENV_ROOT")
|
||||||
// TODO: pyenv-win has this at $PYENV_ROOT/pyenv-win/shims
|
if !strings.HasPrefix(cmdPath, pyEnvRoot) {
|
||||||
if cmdPath != filepath.Join(pyEnvRoot, "shims", "python") {
|
|
||||||
return "", fmt.Errorf("executable at %s is not a pyenv shim", cmdPath)
|
return "", fmt.Errorf("executable at %s is not a pyenv shim", cmdPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue