When running commands via pwsh -c '<command>', PowerShell will return an exit code of 1 in the event that <command> returns an exit code greater than 0. This is particularly problematic for tools like https://github.com/dense-analysis/ale/, which rely on an accurate exit code from the command which they spawn (a linter or fixer in this case).
Steps to reproduce
pwsh -c "bash -c 'exit 2'"; echo $LASTEXITCODE
Expected behavior
The exit code of the native application should be returned.
Actual behavior
PowerShell returns a generic "failure" exit code of 1.
Environment data
Name Value
---- -----
PSVersion 7.0.0-rc.1
PSEdition Core
GitCommitId 7.0.0-rc.1
OS Darwin 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 201…
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0, 5.0, 5.1.10032.0, 6.0.0, 6.1.0, 6.2.0, 7.0.0-rc.1}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
When running commands via
pwsh -c '<command>', PowerShell will return an exit code of1in the event that<command>returns an exit code greater than0. This is particularly problematic for tools like https://github.com/dense-analysis/ale/, which rely on an accurate exit code from the command which they spawn (a linter or fixer in this case).Steps to reproduce
Expected behavior
The exit code of the native application should be returned.
Actual behavior
PowerShell returns a generic "failure" exit code of
1.Environment data