Skip to content

Make exit code available in catch block - #12648

Merged
IanManske merged 2 commits into
nushell:mainfrom
IanManske:try-exit-code
Apr 26, 2024
Merged

IanManske merged 2 commits into
nushell:mainfrom
IanManske:try-exit-code

Conversation

@IanManske

@IanManske IanManske commented Apr 24, 2024 •

Copy link
Copy Markdown
Member

Description

Bandaid fix for #12643, where it is not possible to get the exit code of a failed external command while also having the external command inherit nushell's stdout and stderr. This changes try so that the exit code of external command is available in the catch block via the usual $env.LAST_EXIT_CODE.

Tests + Formatting

Added one test.

After Submitting

Rework I/O redirection and possibly exit codes.

@IanManske IanManske added the notes:fixes Noted in "Bug fixes" section label Apr 24, 2024
@IanManske
IanManske merged commit 1ecbb3e into nushell:main Apr 26, 2024
@hustcer hustcer added this to the v0.93.0 milestone Apr 27, 2024
maxim-uvarov pushed a commit to maxim-uvarov/nushell that referenced this pull request May 1, 2024
# Description
Bandaid fix for nushell#12643, where it is not possible to get the exit code of
a failed external command while also having the external command inherit
nushell's stdout and stderr. This changes `try` so that the exit code of
external command is available in the `catch` block via the usual
`$env.LAST_EXIT_CODE`.

# Tests + Formatting
Added one test.

# After Submitting
Rework I/O redirection and possibly exit codes.
@IanManske
IanManske deleted the try-exit-code branch May 27, 2024 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:fixes Noted in "Bug fixes" section

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants