-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-AnsweredThe question is answered.The question is answered.Resolution-By DesignThe reported behavior is by design.The reported behavior is by design.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Milestone
Description
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 $LASTEXITCODEExpected behavior
The exit code of the native application should be returned.
2
Actual behavior
PowerShell returns a generic "failure" exit code of 1.
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
mklement0 and mpawelski
Metadata
Metadata
Assignees
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-AnsweredThe question is answered.The question is answered.Resolution-By DesignThe reported behavior is by design.The reported behavior is by design.WG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime