From 11625ec13132ee19337fd5a4ee082e99666731a3 Mon Sep 17 00:00:00 2001
From: Tester798
Date: Thu, 13 Apr 2023 15:25:59 +0300
Subject: [PATCH] Fix symlink detect if it points to nothing
---
src/nvm.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/nvm.go b/src/nvm.go
index 667b54be..9c156699 100644
--- a/src/nvm.go
+++ b/src/nvm.go
@@ -644,7 +644,7 @@ func use(version string, cpuarch string, reload ...bool) {
}
// Remove symlink if it already exists
- sym, _ := os.Stat(env.symlink)
+ sym, _ := os.Lstat(env.symlink)
if sym != nil {
// _, err := runElevated(fmt.Sprintf(`"%s" cmd /C rmdir "%s"`, filepath.Join(env.root, "elevate.cmd"), filepath.Clean(env.symlink)))
_, err := elevatedRun("rmdir", filepath.Clean(env.symlink))