Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Powershell exception is translated to exit code 0 #338

Open
wwylele opened this issue Jul 13, 2022 · 0 comments
Open

Uncaught Powershell exception is translated to exit code 0 #338

wwylele opened this issue Jul 13, 2022 · 0 comments

Comments

@wwylele
Copy link

wwylele commented Jul 13, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant