Skip to content

Remove 'Press any key to exit' in basic-rs and basic-cpp templates#4468

Merged
clockwork-labs-bot merged 2 commits intomasterfrom
bot/fix-press-any-key
Feb 26, 2026
Merged

Remove 'Press any key to exit' in basic-rs and basic-cpp templates#4468
clockwork-labs-bot merged 2 commits intomasterfrom
bot/fix-press-any-key

Conversation

@clockwork-labs-bot
Copy link
Collaborator

The basic-rs and basic-cpp templates say "Press any key to exit..." but stdin is line-buffered in cooked mode, so read(&mut [0u8]) actually blocks until Enter is pressed.

Adding a real "any key" handler would require a terminal crate dependency (crossterm, termion, etc.) which is heavy for a starter template. Instead, change the message to "Press Enter to exit..." and use read_line() to match the actual behavior.

Also removes the unused Read import.

@bfops bfops requested review from bfops and jdetter February 26, 2026 01:01
bfops
bfops previously approved these changes Feb 26, 2026
Copy link
Collaborator

@bfops bfops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Builds and runs properly for me 🤷

@clockwork-labs-bot clockwork-labs-bot added this pull request to the merge queue Feb 26, 2026
@bfops bfops removed this pull request from the merge queue due to a manual request Feb 26, 2026
@bfops bfops dismissed their stale review February 26, 2026 03:26

dismissing my review because I'm waiting for another approval and I don't want the bot merging this prematurely

Copy link
Contributor

@cloutiertyler cloutiertyler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also seems fine, but why does this only apply to basic-rs and basic-cpp, presumably it should also apply to basic-cs and basic-ts right?

Instead of prompting for input and exiting, keep the main thread alive
with a sleep loop so the connection stays open — matching the behavior
of basic-cs and basic-ts which stay alive via their event loops.
@bfops bfops changed the title Fix 'Press any key to exit' in basic-rs and basic-cpp templates Remove 'Press any key to exit' in basic-rs and basic-cpp templates Feb 26, 2026
@clockwork-labs-bot clockwork-labs-bot added this pull request to the merge queue Feb 26, 2026
Merged via the queue into master with commit 6382220 Feb 26, 2026
116 of 121 checks passed
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.

4 participants