Fixes #41 - Issue with blank spaces in path

Forgot some uses of exec.Command() outside of the "use" command.
This commit is contained in:
Andreas Opferkuch
2018-05-21 17:08:34 +02:00
parent 44a2e1ddbe
commit ebdd4d986f

View File

@@ -340,8 +340,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 {
@@ -544,8 +545,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")
}