Repository navigation
orly-repl: don't abort in-flight entries on stdin EOF; let exit flush (#542) - #543
Merged
Merged
Conversation
…#542) With piped stdin (printf ... | orly-repl, the docker repl mode's shape), readline's close event fires as soon as input is exhausted -- while the first entry is still compiling. quit() ran immediately, tearing down the WebSocket and scratch dir under the entry, and process.exit(0) then truncated the pending stderr write, so the failure was silent: banner, one prompt, exit 0, no output. The interactive path never hits this because stdin stays open; the smoke held its pipe open too, which is why CI on #536 was green. Stdin EOF now chains quit() onto the entry queue (quit after pending entries drain -- Ctrl-D semantics unchanged), and quit sets process.exitCode instead of calling process.exit, letting the event loop drain and output flush once stdin, readline, and the socket are all closed. The smoke gains a piped-EOF regression scenario: write an expression, close stdin immediately, require the result and exit 0. Verified additionally inside the published docker image against the exact failing invocation from the docker gate on #539.
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 #542. Unblocks #539 (its docker gate is what exposed this).
Bug
printf '40 + 2;\n:quit\n' | orly-repl ...printed the banner and one prompt, then exited 0 with no result and no error. Two defects compounding:close(stdin EOF) fired while the first entry was still compiling, and the handler quit immediately — closing the WebSocket and deleting the scratch dir under the in-flight entry.process.exit(0)truncated the aborted entry's pending stderr write, making the failure silent.Interactive use never hits it (stdin stays open), and the existing smoke held its stdin pipe open until after
:quit— which is why CI on #536 was green while #539'sprintf | docker run -igate failed.Fix
quit()onto the serialized entry queue: quit happens after pending entries drain. Ctrl-D semantics unchanged.quit()setsprocess.exitCodeinstead of callingprocess.exit; with stdin, readline, and the socket closed, the event loop drains naturally and output always flushes.Verification
orly> 42, exit 0.