MicrosoftDocs / terminal

Creative Commons Attribution 4.0 International
470 stars 177 forks source link

Fix LastExitCode handling in the shell integration pwsh sample #690

Closed mdgrs-mei closed 1 year ago

mdgrs-mei commented 1 year ago

The pwsh example for the shell integration does not report an error code once $LastExitCode is set to 0.

Try:

PS > cmd /c exit 0
PS > a

image

This PR fixes this issue by detecting external command errors using the history and the $Error variable.

learn-build-service-prod[bot] commented 1 year ago

Learn Build status updates of commit f715109:

:white_check_mark: Validation status: passed

File Status Preview URL Details
TerminalDocs/tutorials/shell-integration.md :white_check_mark:Succeeded View

For more details, please refer to the build report.

For any questions, please: