From 3614e26046f4f59a98d1fbc3b86ce3e59f47c100 Mon Sep 17 00:00:00 2001 From: Andreas Weber Date: Mon, 13 May 2024 05:11:36 +0200 Subject: [PATCH] fix: return err if symlink is not created (#259) --- internal/sdk.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/sdk.go b/internal/sdk.go index 316f716d..b2577a41 100644 --- a/internal/sdk.go +++ b/internal/sdk.go @@ -19,7 +19,6 @@ package internal import ( "errors" "fmt" - "github.com/version-fox/vfox/internal/shim" "io" "net" "net/http" @@ -31,6 +30,8 @@ import ( "strings" "syscall" + "github.com/version-fox/vfox/internal/shim" + "github.com/pterm/pterm" "github.com/schollz/progressbar/v3" "github.com/version-fox/vfox/internal/env" @@ -67,14 +68,14 @@ func (s *SdkEnv) linkToCurrent(targetDir string) (*env.Paths, error) { } if util.FileExists(tp) { if err := os.Remove(tp); err != nil { - logger.Debugf("Failed to remove symlink %s\n", tp) - continue + logger.Errorf("Failed to remove symlink %s\n", tp) + return nil, err } } _ = os.MkdirAll(targetDir, 0755) if err := util.MkSymlink(p, tp); err != nil { - logger.Debugf("Failed to create symlink %s -> %s\n", p, targetDir) - continue + logger.Errorf("Failed to create symlink %s -> %s\n", p, tp) + return nil, err } paths.Add(tp) }