Added mkdir command filter for WinRM to be compatible with PS4+
This commit is contained in:
parent
89beb695f2
commit
361d41527a
|
@ -11,6 +11,7 @@ module VagrantPlugins
|
||||||
"test",
|
"test",
|
||||||
"uname",
|
"uname",
|
||||||
"which",
|
"which",
|
||||||
|
"mkdir",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Filter the given Vagrant command to ensure compatibility with Windows
|
# Filter the given Vagrant command to ensure compatibility with Windows
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
module VagrantPlugins
|
||||||
|
module CommunicatorWinRM
|
||||||
|
module CommandFilters
|
||||||
|
# Converts a *nix 'mkdir' command to a PowerShell equivalent
|
||||||
|
class Mkdir
|
||||||
|
def filter(command)
|
||||||
|
# mkdir -p /some/dir
|
||||||
|
# mkdir /some/dir
|
||||||
|
cmd_parts = command.strip.split(/\s+/)
|
||||||
|
dir = cmd_parts.pop
|
||||||
|
while !dir.nil? && dir.start_with?('-')
|
||||||
|
dir = cmd_parts.pop
|
||||||
|
end
|
||||||
|
# This will ignore any -p switches, which are redundant in PowerShell,
|
||||||
|
# and ambiguous in PowerShell 4+
|
||||||
|
return "mkdir #{dir} -force"
|
||||||
|
end
|
||||||
|
|
||||||
|
def accept?(command)
|
||||||
|
command.start_with?('mkdir ')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue