mirror of
https://github.com/NCBM/plyngent.git
synced 2026-11-07 07:17:54 +08:00
core/cli: keep the limit prompt line on the terminal
Once the limit prompt offered its three answers as notification buttons, the read took the button path and skipped the prompt line the terminal used to print: the human at the terminal saw the reason and then an indefinite wait, with nothing saying what to type. It writes the line again, as every other prompt that reads both surfaces already does.
This commit is contained in:
@@ -232,6 +232,11 @@ def _decide_continue_limit(reason: str) -> bool:
|
||||
else:
|
||||
# Same read as the timed confirms: stdin or the notification,
|
||||
# whichever answers first, with the terminal's default on silence.
|
||||
# The prompt line still goes to the terminal: the buttons elsewhere
|
||||
# do not say what typing here would do.
|
||||
with contextlib.suppress(OSError):
|
||||
_ = sys.stderr.write(_CONTINUE_PROMPT)
|
||||
_ = sys.stderr.flush()
|
||||
token = (_read_answer(None, wait) or "").strip().lower()
|
||||
if not token:
|
||||
token = "y"
|
||||
|
||||
Reference in New Issue
Block a user