summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Edwards <adamed@opscode.com>2015-03-15 14:47:55 -0700
committerKartik Null Cating-Subramanian <ksubramanian@chef.io>2015-05-29 16:58:55 -0400
commit56eadf31275fa21f934d20a218cf63c0270d34be (patch)
tree07c42bc57440e81e2359cb9973e7640a77a05842
parent368491c8641deefba59b031ad0381bc34b2ae7f8 (diff)
downloadchef-56eadf31275fa21f934d20a218cf63c0270d34be.tar.gz
Simplify powershell_script exit status logic
-rw-r--r--lib/chef/provider/powershell_script.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/chef/provider/powershell_script.rb b/lib/chef/provider/powershell_script.rb
index c05ae71f72..de06ddbe25 100644
--- a/lib/chef/provider/powershell_script.rb
+++ b/lib/chef/provider/powershell_script.rb
@@ -91,7 +91,9 @@ $chefscriptresult =
$global:lastcmdlet = $?
}.invokereturnasis()
-$exitstatus = 0
+# Assume failure status of 1 -- success cases
+# will have to override this
+$exitstatus = 1
# If convert_boolean_return is enabled, the block's return value
# gets precedence in determining our exit status
@@ -113,11 +115,6 @@ elseif ( $LASTEXITCODE -ne $null -and $LASTEXITCODE -ne 0 )
# status.
$exitstatus = $LASTEXITCODE
}
-else
-{
- # We just have a failed cmdlet, we should return 1
- $exitstatus = 1
-}
# If this script is launched with -File, the process exit
# status of PowerShell.exe will be $exitstatus. If it was