Skip to content

[codex] Exit top-level loop on stdin EOF - #49

Draft
juangrukat wants to merge 1 commit into
tiancaiamao:masterfrom
juangrukat:codex/exit-on-stdin-eof
Draft

[codex] Exit top-level loop on stdin EOF#49
juangrukat wants to merge 1 commit into
tiancaiamao:masterfrom
juangrukat:codex/exit-on-stdin-eof

Conversation

@juangrukat

Copy link
Copy Markdown

Summary

  • stop the top-level Shen loop when stdin reaches EOF
  • keep existing error printing for non-EOF read/eval errors
  • update the generated Go top-level runtime to match the Shen source change

Why

When Shen is run with piped stdin or redirected file input, EOF becomes error: empty stream. The top-level loop traps that error, prints it, and then recurses, which causes an endless stream of error: empty stream messages after the input file has finished.

This treats that EOF condition as a clean termination signal instead.

Validation

  • go test ./...
  • make shen
  • printf '(+ 1 2)\n' | ./shen
  • ./shen < /Users/kat/Desktop/a/tests.shen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant