On 2020-04-21 08:20, Cameron Simpson wrote: > On 19Apr2020 22:06, Tim Chase <[email protected]> wrote: > >I'm playing around with a curses program and would like it to > >behave similarly to how vim lets me do > > > > $ echo hello | vim - > > > >where vim reads data from stdin but then interacts with the > >terminal directrly. What magic is vim doing here? > > Typically stdin, stdout and stderr are all os.dup()s of the > terminal. > > In the above vim's stdin will of course be the pipe but stdout and > stderr are still attached; it could dup one of them to stdin again > and proceed. > > Or it might just open /dev/tty again after reading stdin if that > isn't a tty.
Thanks, Cameron & Eli. I tried meandering through the vim source and, while this is what it looked like it was doing (i.e., using stderr for input), it made no sense to me. Now it makes more sense. So now at least I have two possible courses of action (use stderr or (re)open /dev/tty). Time to try and bludgeon curses into pulling its input from some place other than stdin. Or possibly re-attaching stdin to the stderr file descriptor. Thanks again! -tim -- -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200421141438.395b9b12%40bigbox.attlocal.net.
