Merge pull request #7281 from pauloj95/patch-1
add force to powershell move command
This commit is contained in:
commit
956bc35769
|
@ -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\"",
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue