From 594970f18dee92308fd1554663cc408cda4d102c Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sun, 27 Sep 2026 18:20:06 -0300 Subject: Make pty/run and /log streams, and take refused lines back cleanly Review fixes to pty/run and /log: - Both are streams with a per-open cursor. A shell's exec 3<>file shares one offset between write and read, so cat <&3 after echo make >&3 asked for offset 5 and got "0" instead of "exit 0"; log after follow lost its first bytes the same way. - A run is accepted only in pardes's own tagged input phase, so a nested shell's prompt (ssh, a shell with its own integration) is never taken for this shell's. - A line the shell refused is taken back so the next finds the prompt clear: bash's continuation prompt (now tagged k=c) gets Ctrl-C and the answer waits for the fresh prompt; a bash syntax error (no C, but a D) is answered at once; fish's kept line gets Ctrl-U (a Ctrl-C sent while fish redraws is lost). fish's right prompt no longer reads as typed input. - bash marks a command's start from PS0 on bash 4.4+, not a DEBUG trap, so a user's own DEBUG trap (bash-preexec, atuin) survives. bash's own job notices now show as in plain bash (ttyfollow golden). - 32 run slots; a new line on an open starts a fresh answer. Checked live in bash, fish, and fish with a right prompt. Co-Authored-By: Claude Opus 5.5 --- test/fs.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/fs.py') diff --git a/test/fs.py b/test/fs.py index ff085a55..d44f417d 100644 --- a/test/fs.py +++ b/test/fs.py @@ -311,6 +311,9 @@ def run_file(binary): time.sleep(.05) assert run(client, term, b'false\n') == b'exit 1\n' assert run(client, term, b'sh -c "exit 7"\n') == b'exit 7\n' + assert run(client, term, b'fi\n') == b'error not run\n' # a syntax error runs nothing + assert run(client, term, b"echo 'open\n") == b'error not run\n' # nor does an open quote + assert run(client, term, b'true\n') == b'exit 0\n' # ...and the shell is clear after with Client(address) as other: slow = [] waiter = threading.Thread(target=lambda: slow.append(run(other, term, b'sleep 1\n')), daemon=True) -- cgit v1.3