Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes: light proxy did not pipe stdin, detect command empty display on error #193

Merged
merged 2 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cmd/tenv/subcmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ func newDetectCmd(conf *config.Config, versionManager versionmanager.VersionMana
detectedVersion, err := versionManager.Detect(false)
if err != nil {
loghelper.StdDisplay(err.Error())

if err != versionmanager.ErrNoCompatibleLocally {
return
}
}
loghelper.StdDisplay(loghelper.Concat(versionManager.FolderName, " ", detectedVersion, " will be run from this directory."))
},
Expand Down
6 changes: 3 additions & 3 deletions versionmanager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
var (
errEmptyVersion = errors.New("empty version")
errNoCompatible = errors.New("no compatible version found")
errNoCompatibleLocally = errors.New("no compatible version found locally")
ErrNoCompatibleLocally = errors.New("no compatible version found locally")
)

type ReleaseInfoRetriever interface {
Expand Down Expand Up @@ -314,7 +314,7 @@ func (m VersionManager) Uninstall(requestedVersion string) error {
func (m VersionManager) Use(requestedVersion string, workingDir bool) error {
detectedVersion, err := m.Evaluate(requestedVersion, false)
if err != nil {
if err != errNoCompatibleLocally {
if err != ErrNoCompatibleLocally {
return err
}

Expand All @@ -334,7 +334,7 @@ func (m VersionManager) autoInstallDisabledMsg(version string) error {
m.conf.Displayer.Flush(false) // Always normal display when installation is missing
m.conf.Displayer.Display(loghelper.Concat("Auto-install is disabled. To install ", m.FolderName, " version ", version, ", you can set environment variable TENV_AUTO_INSTALL=true, or install it via any of the following command: 'tenv ", cmdName, " install', 'tenv ", cmdName, " install ", version, "'"))

return errNoCompatibleLocally
return ErrNoCompatibleLocally
}

func (m VersionManager) checkVersionInstallation(version string) (bool, error) {
Expand Down
1 change: 1 addition & 0 deletions versionmanager/proxy/light/light.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func Exec(execName string) {
// proxy to selected version
cmd := exec.Command(cmdconst.TenvName, cmdArgs...) //nolint
cmd.Stderr = os.Stderr
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
err := cmd.Start()
if err != nil {
Expand Down
Loading