summaryrefslogtreecommitdiff
path: root/lib/ansible/executor/powershell/module_wrapper.ps1
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ansible/executor/powershell/module_wrapper.ps1')
-rw-r--r--lib/ansible/executor/powershell/module_wrapper.ps15
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ansible/executor/powershell/module_wrapper.ps1 b/lib/ansible/executor/powershell/module_wrapper.ps1
index 20a96773..1cfaf3ce 100644
--- a/lib/ansible/executor/powershell/module_wrapper.ps1
+++ b/lib/ansible/executor/powershell/module_wrapper.ps1
@@ -207,7 +207,10 @@ if ($null -ne $rc) {
# with the trap handler that's now in place, this should only write to the output if
# $ErrorActionPreference != "Stop", that's ok because this is sent to the stderr output
# for a user to manually debug if something went horribly wrong
-if ($ps.HadErrors -or ($PSVersionTable.PSVersion.Major -lt 4 -and $ps.Streams.Error.Count -gt 0)) {
+if (
+ $ps.Streams.Error.Count -and
+ ($ps.HadErrors -or $PSVersionTable.PSVersion.Major -lt 4)
+) {
Write-AnsibleLog "WARN - module had errors, outputting error info $ModuleName" "module_wrapper"
# if the rc wasn't explicitly set, we return an exit code of 1
if ($null -eq $rc) {