Skip to content

Commit

Permalink
Fixes: light proxy did not pipe stdin, detect command empty display o…
Browse files Browse the repository at this point in the history
…n error (#193)

* light proxy did not pipe input #191 #192
* fix detect empty display with no compatible

Signed-off-by: Denis Vaumoron <[email protected]>
  • Loading branch information
dvaumoron authored Jun 27, 2024
1 parent afe6698 commit 87241b9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
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

0 comments on commit 87241b9

Please sign in to comment.