Repository navigation
Keep the exit status when the CLI cannot print an error to stderr - #16080
Merged
josevalim merged 2 commits intoNov 8, 2026
Merged
Conversation
When a script raises and stderr cannot be written to (a closed descriptor, or a pipe whose reader has exited), Kernel.CLI.print_error/3 raised from inside the catch in exec_fun/2, the :DOWN branch tried to print again, and the exception escaped Kernel.CLI.run/1 into init:start_it: the VM reported "Runtime terminating during boot" and wrote an erl_crash.dump into the cwd instead of exiting with status 1. print_error/3 now treats the stderr write as best-effort. Closes elixir-lang#16079 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018wugBUzZrvZNchWxmRqJgH
josevalim
reviewed
Nov 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #16079.
When a script raises and stderr cannot be written to (a closed descriptor, or a pipe whose reader has exited),
Kernel.CLI.print_error/3raised from inside thecatchinexec_fun/2, the:DOWNbranch tried to print again, and the exception escapedKernel.CLI.run/1intoinit:start_it: "Runtime terminating during boot" and anerl_crash.dumpin the cwd, instead of exit status 1.print_error/3now treats the stderr write as best-effort. The test runselixir -e "raise ArgumentError"with stderr a dead pipe and asserts status 1 and no crash dump; it fails before this change and passes after.make formatis clean andmake test_stdlibpasses on OTP 29.