Repository navigation
Capture writes to standard_error from evaluated code - #3
Merged
Merged
Conversation
Erlang has a single standard_error device per node, so output that evaluated code wrote there ended up on the server's console instead of the client. dialtone_stderr takes over the device's name and forwards writes from eval workers (found through their group leader) to their session's IO server, which sends them to the client as err. Everything else goes to the original device, and so do writes from session processes while no request is running. A forwarded write whose IO server dies gets an error instead of waiting forever. Taking over a node-wide device is too much for an embedded server to do on its own, so it's opt-in through dialtone:capture_stderr/0 or the capture_stderr app env. The standalone server turns it on.
Like bin/dialtone, bin/repartee and mix repartee.server own their node, so they can send what evaluated code writes to :standard_error to the client. That includes Elixir's parse warnings.
chaser treated every err in a response as a failed eval and printed each chunk as its own error block. Now that dialtone streams stderr as err, plain err chunks are printed as they arrive (in red), and the error block is kept for responses with an ex.
bbatsov
force-pushed
the
stderr-capture
branch
from
November 7, 2026 07:20
9d7dca8 to
2010a0a
Compare
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.
What evaluated code writes to
standard_errorused to end up on the server's console, so clients never saw it. There's only onestandard_errorper node, so capturing it means taking over a device the whole node shares. That's why it's opt-in for embedded servers and turned on only inbin/dialtone,bin/reparteeandmix repartee.server. Writes from the rest of the node, and from session processes between evals, still go to the console.chaser shows stderr as streamed output now, rather than as an error block per chunk.
This replaces #2, which got closed when the branch it was based on went away.