From e22767184bba26b2023d4d0a024490e2b2ffee65 Mon Sep 17 00:00:00 2001 From: Matt Wrock Date: Sun, 24 Aug 2014 10:09:14 -0700 Subject: [PATCH] exit wit code 1 from powershell commands that fail but do not send an exit code --- plugins/communicators/winrm/shell.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/communicators/winrm/shell.rb b/plugins/communicators/winrm/shell.rb index 4a5a3c25a..353c0e84d 100644 --- a/plugins/communicators/winrm/shell.rb +++ b/plugins/communicators/winrm/shell.rb @@ -54,7 +54,7 @@ module VagrantPlugins def powershell(command, &block) # ensure an exit code command << "\r\n" - command << "if ($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 0 }" + command << "if ($?) { exit 0 } else { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } }" execute_shell(command, :powershell, &block) end