Powershell возвращает код выхода 0, когда произошла ошибка, если вызывается с -File Это означает, что моя сборка зеленая, хотя она не должна быть :(
Например:
(в wtf.ps1)
$ErrorActionPreference = "Stop";
$null.split()
(cmd)
powershell -file c:\wtf.ps1
You cannot call a method on a null-valued expression.
At C:\wtf.ps1:3 char:12
+ $null.split <<<< ()
+ CategoryInfo : InvalidOperation: (split:String) [], ParentConta
insErrorRecordException
+ FullyQualifiedErrorId : InvokeMethodOnNull
echo %errorlevel%
0
powershell c:\wtf.ps1
You cannot call a method on a null-valued expression.
At C:\wtf.ps1:3 char:12
+ $null.split <<<< ()
+ CategoryInfo : InvalidOperation: (split:String) [], ParentConta
insErrorRecordException
+ FullyQualifiedErrorId : InvokeMethodOnNull
echo %errorlevel%
1
Есть идеи?
(У меня есть перепробовал почти все идеи с первых двух страниц этого: https://www.google.co.uk/search?q=powershell+file+argument+exit+codeуже)