test command should expand environment variables
'$Env:SystemRoot' does not expand "$Env:SystemRoot" does expand
This commit is contained in:
parent
3efb4b1def
commit
ac81841b01
|
@ -14,20 +14,20 @@ module VagrantPlugins
|
|||
cmd_parts = command.strip.split(/\s+/)
|
||||
if cmd_parts[1] == '-d'
|
||||
# ensure it exists and is a directory
|
||||
return "if ((Test-Path '#{cmd_parts[2]}') -and (get-item '#{cmd_parts[2]}').PSIsContainer) { exit 0 } exit 1"
|
||||
return "if ((Test-Path \"#{cmd_parts[2]}\") -and (get-item \"#{cmd_parts[2]}\").PSIsContainer) { exit 0 } exit 1"
|
||||
elsif cmd_parts[1] == '-f' || cmd_parts[1] == '-x'
|
||||
# ensure it exists and is a file
|
||||
return "if ((Test-Path '#{cmd_parts[2]}') -and (!(get-item '#{cmd_parts[2]}').PSIsContainer)) { exit 0 } exit 1"
|
||||
return "if ((Test-Path \"#{cmd_parts[2]}\") -and (!(get-item \"#{cmd_parts[2]}\").PSIsContainer)) { exit 0 } exit 1"
|
||||
end
|
||||
|
||||
# otherwise, just check for existence
|
||||
return "if (Test-Path '#{cmd_parts[2]}') { exit 0 } exit 1"
|
||||
return "if (Test-Path \"#{cmd_parts[2]}\") { exit 0 } exit 1"
|
||||
end
|
||||
|
||||
# if (Test-Path 'c:\windows' && (get-item 'c:\windows').PSIsContainer) { Write-Host 0 } Write-Host 1
|
||||
|
||||
def accept?(command)
|
||||
command.start_with?('test ')
|
||||
command.start_with?("test ")
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue