Skip to content

Commit ebdd4d9

Browse files
committed
Fixes #41 - Issue with blank spaces in path
Forgot some uses of exec.Command() outside of the "use" command.
1 parent 44a2e1d commit ebdd4d9

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/nvm.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,9 @@ func uninstall(version string) {
340340
fmt.Printf("Uninstalling node v"+version+"...")
341341
v, _ := node.GetCurrentVersion()
342342
if v == version {
343-
cmd := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "rmdir", env.symlink)
344-
cmd.Run()
343+
runElevated(fmt.Sprintf(`"%s" cmd /C rmdir "%s"`,
344+
filepath.Join(env.root, "elevate.cmd"),
345+
filepath.Clean(env.symlink)))
345346
}
346347
e := os.RemoveAll(filepath.Join(env.root, "v"+version))
347348
if e != nil {
@@ -544,8 +545,12 @@ func enable() {
544545
}
545546

546547
func disable() {
547-
cmd := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "rmdir", env.symlink)
548-
cmd.Run()
548+
if !runElevated(fmt.Sprintf(`"%s" cmd /C rmdir "%s"`,
549+
filepath.Join(env.root, "elevate.cmd"),
550+
filepath.Clean(env.symlink))) {
551+
return
552+
}
553+
549554
fmt.Println("nvm disabled")
550555
}
551556

0 commit comments

Comments
 (0)