Skip to content

Uncaught Powershell exception is translated to exit code 0 #338

@wwylele

Description

@wwylele

I am not sure whether Windows itself is at fault or this is something that can be fixed in this library. Feel free to close this if the root problem is in Windows.

When I use WinRM to run powershell script, if an exception is thrown to the top level without being caught, it logs the error message in stderr, but the exit code is still 0 indicating success. This is confusing because if I run a powershell file locally, the exit code would be 1 if an exception is thrown. There isn't any method to explicitly check uncaught exception, either, so it is cumbersome to work with scripts that can throw.

The version we are using is 2.2 and I can't change it easily. Please let me know if there is any difference between 2.2 and the latest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions