Skip to content

Commit

Permalink
Merge pull request hashicorp#7281 from pauloj95/patch-1
Browse files Browse the repository at this point in the history
add force to powershell move command
  • Loading branch information
SwampDragons authored Feb 12, 2019
2 parents c7278e8 + b1fffee commit 956bc35
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion provisioner/guest_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var guestOSTypeCommands = map[string]guestOSTypeCommand{
mkdir: "powershell.exe -Command \"New-Item -ItemType directory -Force -ErrorAction SilentlyContinue -Path %s\"",
removeDir: "powershell.exe -Command \"rm %s -recurse -force\"",
statPath: "powershell.exe -Command { if (test-path %s) { exit 0 } else { exit 1 } }",
mv: "powershell.exe -Command \"mv %s %s\"",
mv: "powershell.exe -Command \"mv %s %s -force\"",
},
}

Expand Down
4 changes: 2 additions & 2 deletions provisioner/guest_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,13 @@ func TestMovePath(t *testing.T) {
t.Fatalf("Failed to create new GuestCommands for OS: %s", WindowsOSType)
}
cmd = guestCmd.MovePath("C:\\Temp\\SomeDir", "C:\\Temp\\NewDir")
if cmd != "powershell.exe -Command \"mv C:\\Temp\\SomeDir C:\\Temp\\NewDir\"" {
if cmd != "powershell.exe -Command \"mv C:\\Temp\\SomeDir C:\\Temp\\NewDir -force\"" {
t.Fatalf("Unexpected Windows remove dir cmd: %s", cmd)
}

// Windows OS w/ space in path
cmd = guestCmd.MovePath("C:\\Temp\\Some Dir", "C:\\Temp\\New Dir")
if cmd != "powershell.exe -Command \"mv C:\\Temp\\Some` Dir C:\\Temp\\New` Dir\"" {
if cmd != "powershell.exe -Command \"mv C:\\Temp\\Some` Dir C:\\Temp\\New` Dir -force\"" {
t.Fatalf("Unexpected Windows remove dir cmd: %s", cmd)
}
}

0 comments on commit 956bc35

Please sign in to comment.