From ac81841b014059195e95e182a177d4923ee57116 Mon Sep 17 00:00:00 2001 From: Shawn Neal Date: Wed, 23 Apr 2014 18:26:45 -0700 Subject: [PATCH] test command should expand environment variables '$Env:SystemRoot' does not expand "$Env:SystemRoot" does expand --- plugins/communicators/winrm/command_filters/test.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/communicators/winrm/command_filters/test.rb b/plugins/communicators/winrm/command_filters/test.rb index d837ece0c..76850be06 100644 --- a/plugins/communicators/winrm/command_filters/test.rb +++ b/plugins/communicators/winrm/command_filters/test.rb @@ -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