From 7223e29330fd48d324de23309b370aaeb6208c5b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 14 Mar 2014 10:59:19 -0700 Subject: [PATCH] communicators/winrm: fix powershell execution --- plugins/communicators/winrm/communicator.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/communicators/winrm/communicator.rb b/plugins/communicators/winrm/communicator.rb index 2782bcfd3..6e9eb1db5 100644 --- a/plugins/communicators/winrm/communicator.rb +++ b/plugins/communicators/winrm/communicator.rb @@ -102,15 +102,15 @@ module VagrantPlugins ) end - def do_execute(command, shell, &block) - if shell.eql? :cmd - shell.cmd(command, &block)[:exitcode] - else - script = File.expand_path("../scripts/command_alias.ps1", __FILE__) - script = File.read(script) - command = script << "\r\n" << command << "\r\nexit $LASTEXITCODE" - shell.powershell(command, &block)[:exitcode] + def do_execute(command, shell_type, &block) + if shell_type == :cmd + return shell.cmd(command, &block)[:exitcode] end + + script = File.expand_path("../scripts/command_alias.ps1", __FILE__) + script = File.read(script) + command = script << "\r\n" << command << "\r\nexit $LASTEXITCODE" + shell.powershell(command, &block)[:exitcode] end def raise_execution_error(opts, exit_code)