I have a set of test DLL\'s that I\'m running from a powershell script that calls OpenCover.Console.exe via the Start-Process
command.
I have the
When executing a GUI application, dropping the Start-Process
does not help, as PowerShell does not wait for GUI application to complete, when executing them directly this way. So $LASTEXITCODE
is not set.
Piping the (non existing) GUI application output helps, as it makes PowerShell to wait for the application to complete.
notepad.exe | Out-Null
echo $LASTEXITCODE
Note that "GUI application" does not necessarily mean that the application has windows. Whether an application is GUI or console is a flag in .exe file header.
Start-Process -PassThru -Wait
as suggested in the answer by @Burt_Harris works too in this case, it's just a bit mode complicated.