Skip to content

Commit 7c83f53

Browse files
committed
State the absent-input note per backend semantics
The shared note claimed a script waiting for input runs to the timeout, which is wrong for the backends that hand end-of-file at spawn and steered the patcher toward nonexistent stdin reads. ConPTY, which cannot deliver an end-of-file, states its own note.
1 parent 9f182a5 commit 7c83f53

3 files changed

Lines changed: 15 additions & 15 deletions

File tree

‎render_machine/_conpty.py‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@
5656
DRAIN_DEADLINE_SECONDS,
5757
GRACE_TICK_SECONDS,
5858
HANDSHAKE_TIMEOUT_SECONDS,
59-
)
60-
from render_machine.terminal_process import NO_INPUT_NOTE as DEFAULT_NO_INPUT_NOTE
61-
from render_machine.terminal_process import (
6259
OWNER_PARENT,
6360
OWNER_READER,
6461
POLL_INTERVAL_SECONDS,
@@ -162,11 +159,12 @@
162159
# reaches only processes sharing the caller's console and the target is on the pseudoconsole.
163160
CONTROL_C_BYTE = b"\x03"
164161

165-
# The absent-input note this backend adds to, stated where the asymmetry is documented: a
166-
# script that reads input blocks until the execution timeout rather than seeing end-of-file.
167-
NO_INPUT_NOTE = DEFAULT_NO_INPUT_NOTE + (
168-
" On Windows the terminal carries no synthetic end-of-file, so such a script blocks until the "
169-
"timeout instead of reading end-of-file."
162+
# The absent-input note this backend states itself, where the asymmetry is documented:
163+
# unlike the other backends it cannot hand the target end-of-file, so a script that reads
164+
# terminal input really does block until the execution timeout.
165+
NO_INPUT_NOTE = (
166+
" No input driver was attached to the script's terminal, and on Windows the terminal carries "
167+
"no synthetic end-of-file, so a script that waits for terminal input blocks until the timeout."
170168
)
171169

172170

‎render_machine/terminal_process.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@
8383
OWNER_PARENT = "parent"
8484
OWNER_READER = "reader"
8585

86-
# What a timeout diagnostic says when no input driver was attached. A backend that gives
87-
# the target end-of-file at spawn needs nothing more; ConPTY, which cannot, appends its own
88-
# clause to this one.
86+
# What a timeout diagnostic says when no input driver was attached. A backend that hands
87+
# the target end-of-file at spawn needs nothing more; ConPTY, which cannot deliver an
88+
# end-of-file, states its own note instead.
8989
NO_INPUT_NOTE = (
90-
" No input driver was attached to the script's terminal, so a script that waits for input "
91-
"never receives any and runs to the timeout."
90+
" No input driver was attached to the script's terminal; a script that reads terminal "
91+
"input is handed end-of-file rather than left waiting for it."
9292
)
9393

9494

‎tests/test_conpty.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,12 @@ def test_windows_selects_the_conpty_backend(monkeypatch):
382382

383383
def test_the_backend_notes_that_it_has_no_synthetic_end_of_file():
384384
"""The timeout diagnostic asks the backend that ran, so this one has to state the
385-
asymmetry itself: a script reading input blocks instead of seeing end-of-file."""
385+
asymmetry itself: a script reading input blocks instead of seeing end-of-file — the
386+
base note describes backends that hand end-of-file at spawn, which this one cannot."""
386387
note = ConPtyProcess().no_input_note()
387388

388-
assert note.startswith(NO_INPUT_NOTE)
389+
assert note != NO_INPUT_NOTE
390+
assert "blocks until the timeout" in note
389391
assert "end-of-file" in note
390392

391393

0 commit comments

Comments
 (0)