Skip to content

fix CPU spin on stdin EOF in InteractiveBackend (#42)#54

Merged
lionkor merged 3 commits into
masterfrom
fix/issue-42-screen-dmS-cpu-spin
Jun 16, 2026
Merged

fix CPU spin on stdin EOF in InteractiveBackend (#42)#54
lionkor merged 3 commits into
masterfrom
fix/issue-42-screen-dmS-cpu-spin

Conversation

@lionkor

@lionkor lionkor commented Jun 16, 2026

Copy link
Copy Markdown
Owner

When stdin reaches EOF (e.g. when screen -dmS detaches from the TTY), getchar_no_echo() returns EOF immediately on every call. The input thread loop had no EOF check, causing a tight CPU spin.

Detect EOF and shut down the backend gracefully.

Added regression test (regression_issue42.sh) that forces interactive mode with /dev/null as stdin and verifies CPU usage stays near zero. Integrated as a CTest test.

lionkor added 3 commits June 17, 2026 00:41
When stdin reaches EOF (e.g. when screen -dmS detaches from the TTY),
getchar_no_echo() returns EOF immediately on every call.  The input
thread loop had no EOF check, causing a tight CPU spin.

Detect EOF and shut down the backend gracefully.

Added regression test (regression_issue42.sh) that forces interactive
mode with /dev/null as stdin and verifies CPU usage stays near zero.
Integrated as a CTest test.
@lionkor lionkor force-pushed the fix/issue-42-screen-dmS-cpu-spin branch from e2c63c3 to e5e4f0d Compare June 16, 2026 22:42
@lionkor lionkor merged commit 55d125a into master Jun 16, 2026
3 checks passed
@lionkor lionkor deleted the fix/issue-42-screen-dmS-cpu-spin branch June 16, 2026 22:55
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