Skip to content

Commit

Permalink
Fixes #41 - Issue with blank spaces in path
Browse files Browse the repository at this point in the history
Forgot some uses of exec.Command() outside of the "use" command.
  • Loading branch information
s-h-a-d-o-w committed May 21, 2018
1 parent d0dfb3e commit 683f9d2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/nvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,9 @@ func uninstall(version string) {
fmt.Printf("Uninstalling node v"+version+"...")
v, _ := node.GetCurrentVersion()
if v == version {
cmd := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "rmdir", env.symlink)
cmd.Run()
runElevated(fmt.Sprintf(`"%s" cmd /C rmdir "%s"`,
filepath.Join(env.root, "elevate.cmd"),
filepath.Clean(env.symlink)))
}
e := os.RemoveAll(filepath.Join(env.root, "v"+version))
if e != nil {
Expand Down Expand Up @@ -513,8 +514,12 @@ func enable() {
}

func disable() {
cmd := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "rmdir", env.symlink)
cmd.Run()
if !runElevated(fmt.Sprintf(`"%s" cmd /C rmdir "%s"`,
filepath.Join(env.root, "elevate.cmd"),
filepath.Clean(env.symlink))) {
return
}

fmt.Println("nvm disabled")
}

Expand Down

0 comments on commit 683f9d2

Please sign in to comment.