Skip to content

[WIP] Fix shell initialization race condition with MOTD#3337

Open
unxed wants to merge 1 commit into
elfmz:masterfrom
unxed:vt_wait_fix
Open

[WIP] Fix shell initialization race condition with MOTD#3337
unxed wants to merge 1 commit into
elfmz:masterfrom
unxed:vt_wait_fix

Conversation

@unxed

@unxed unxed commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

Improve VT shell startup by draining initial output before command injection. Previously, a fixed 300ms delay often proved insufficient if MOTD tools like glow were executed in .bashrc, leading to command buffer flushing or premature input loss. This change replaces the static sleep with an active wait loop that monitors terminal output and process group status, ensuring the shell is fully initialized and idle before sending commands.

Touch #3171

Terminal startup was previously relying on a fixed sleep duration, which frequently led to typeahead being swallowed by initialization scripts and TUI programs like glow that consume input while probing terminal features. The updated logic now employs a non-blocking read loop that waits until the output stream remains silent for 300ms, ensuring that the shell and all MOTD content are fully initialized before the command is sent.

Touch elfmz#3171
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