Repository navigation
feat(terminal): read and select wait for typed input - #2542
Merged
Merged
Conversation
With no stdin inside a terminal session, read and select read a typed line from the terminal (read -p/-s/-n/-t supported). Terminal::input_prompt and TerminalTool activity "input" with input_prompt tell an agent a command is asking a question. Narrows L-TERM-002 to cat/head and friends.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | e94da47 | Commit Preview URL Branch Preview URL |
Oct 07 2026, 05:35 AM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
readwith no pipe or redirect now waits for a line typed on the terminal, instead of getting EOF.-pprints the prompt,-sturns echo off,-n Nreturns after N characters, and-t SECSgives up with status 142. Ctrl-D on an empty line is EOF (status 1), and Ctrl-C interrupts the command. Piped or redirected stdin still wins.selectshows its menu andPS3and reads the choice from the terminal.Terminal::input_prompt()returns the question on the cursor line while a command waits for a typed line. This coversread -p,echo -n 'Q? '; readandselect.TerminalToolreportsactivity: "input"withinput_prompt, so an agent can tell a question apart from a busy command. Pythoninput_prompt()and JSinputPrompt()mirror it.read -tdeadline, Ctrl-C) no longer leaves the session marked idle, andrun_until_idlepolls an idle session once more so an expiredread -tfires.Why
Interactive scripts (
read -p "Continue? [y/N]",selectmenus) silently got EOF before. This change narrows L-TERM-002 tocat,headand other commands that still get EOF.Before / After
Tests:
terminal::tests::{read_waits_for_a_typed_line, read_flags_on_terminal, select_reads_choice_from_terminal}andterminal::tool::tests::question_is_reported_as_input. The L-TERM-002 evidence test now usescat. Locally, all 2868 lib tests (--features terminal,git) and 1329 integration tests pass, and clippy is clean with and withoutterminal.Risk
terminalfeature, which is off by default. Without a terminal,readandselectbehave exactly as before.Checklist
Generated by Claude Code