On 2023-01-24 10:34:01 -0600, David Wright wrote: > On Tue 24 Jan 2023 at 17:18:17 (+0100), Vincent Lefevre wrote: > > On 2023-01-22 15:35:08 -0500, Greg Wooledge wrote: > > > It doesn't work, presumably for the same reason that Ctrl-C doesn't work. > > > The xterm's pty's input buffer is full, and it simply ignores all keyboard > > > input from that point forward. > > > > They are actually not ignored, but delayed by the terminal emulator. > > This is an issue because Ctrl-C (the intr character) is normally > > taken into account immediately (with a SIGINT generation), even if > > earlier characters have not been read yet by the command. > > > > And this is apparently the same for the other special characters > > as defined by stty. > > How did you determine that they're actually received by the terminal > emulator after the buffer is full? IOW where are they being stored?
I don't know where they are stored (this is probably part of the terminal code), but 1. Create file1 with printf "%d\n" `seq 9999` > file1 2. Select the contents of file1. 3. In a terminal (xterm in my case), type "some_app ; cat > file2", where some_app is an X application or "sleep 10", for instance. 4. Paste with the middle button in the terminal. 5. Type Ctrl-C in the terminal. 6. Quit some_app (or let it end, e.g. in case of sleep). I get something like: [...] 9982 9983 9984 9985 9986 9987 99^C in the terminal, and file2 ends with "9987" due to the Ctrl-C. Another try: [...] 9979 9980 9981 9982 9983 9984 99^C and this time, the file ends with "9912". This is not surprising as the characters probably appear in the terminal before they are processed by "cat". Since the writes to the pty by xterm and the process by "cat" are concurrent, one doesn't exactly obtain the same result at each test. But in every case, the Ctrl-C is taken into account only near the end. And a test with GNOME Terminal: [...] 9996 9997 9998 9999 ^C and the file ends with "9181". -- Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)