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

Make exit code available in catch block #12648

Merged
merged 2 commits into from
Apr 26, 2024
Merged

Conversation

IanManske
Copy link
Member

@IanManske IanManske commented Apr 24, 2024

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 pr:bugfix This PR fixes some bug label Apr 24, 2024
@IanManske IanManske merged commit 1ecbb3e into nushell:main Apr 26, 2024
15 checks passed
@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
pr:bugfix This PR fixes some bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants