Skip to content

Commit

Permalink
Use filepath.join to escape whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
coreybutler committed Jul 15, 2017
1 parent 506a57d commit 58d157c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/nvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ func use(version string, cpuarch string) {
// Create or update the symlink
sym, _ := os.Stat(env.symlink)
if sym != nil {
cmd := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "rmdir", env.symlink)
cmd := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "rmdir", filepath.Clean(env.symlink))
var output bytes.Buffer
var _stderr bytes.Buffer
cmd.Stdout = &output
Expand All @@ -387,7 +387,7 @@ func use(version string, cpuarch string) {
}
}

c := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "mklink", "/D", env.symlink, filepath.Join(env.root, "v"+version))
c := exec.Command(filepath.Join(env.root, "elevate.cmd"), "cmd", "/C", "mklink", "/D", filepath.Clean(env.symlink), filepath.Join(env.root, "v"+version))
var out bytes.Buffer
var stderr bytes.Buffer
c.Stdout = &out
Expand Down

0 comments on commit 58d157c

Please sign in to comment.