Skip to content

Stop stdin reader from spinning after EOF - #19

Merged
mattn merged 1 commit into
masterfrom
fix-stdin-spin
Jul 10, 2026
Merged

mattn merged 1 commit into
masterfrom
fix-stdin-spin

Conversation

@mattn

@mattn mattn commented Jul 10, 2026

Copy link
Copy Markdown
Owner

The stdin reader goroutine in server() used continue on read errors. After stdin reaches EOF, os.Stdin.Read keeps returning EOF immediately, so the loop busy-spins and repeatedly encodes a close message, burning CPU.

Break out of the loop once a read error (including EOF) occurs.

@mattn
mattn merged commit d6a9cc8 into master Jul 10, 2026
2 checks passed
@mattn
mattn deleted the fix-stdin-spin branch July 10, 2026 07:52
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