Reclaim the Terminal

3 points | by cat-whisperer an hour ago

2 comments

  • zahlman an hour ago

    > This is where my mental model had been backwards. Your keystrokes never go “to stdin.” They go to the terminal, and fd 0 is just a descriptor that usually happens to point there. When the shell pointed fd 0 at a pipe instead, the keyboard did not go anywhere; the process only lost its usual pointer to it. Opening /dev/tty makes a new one. This is what less is doing when you press j: the file arrives on stdin, and your keystrokes come from the terminal.

    Oddly enough, I asked ChatGPT about the same thing probably about a month ago. I understood well enough at the time, but I like this explanation better.

    Something else I've learned about using computers is that it's possible to have blind spots for pretty much arbitrarily long.

      cat-whisperer 24 minutes ago

      Yup, I had so many misconceptions, and during this I got them cleared out. It was pretty cool, rust is so good for such little experiments, LSP helps a bunch