ssh can be run without pty allocation, the remote command can just be run under pipes, for openssh, the option is -T if I read the manual pages correctly. The real question is whether the program you want to run remotely needs a pty (Or the signal processing changes you can get from the pry). Certainly most of the oldstyle tools run fine without a pty - bash, ssh itself, grep, sed, and so forth don't need a pty. vi and such might...but many such tools have a paper tty mode left over from the dark ages when the TI Silent 700 was an advanced terminal. And that means no curses, no pty needed. The rule, to me, is that if the command will run in a pipeline where it gets its input from a pipe and the output can go to a pipe, it probably runs without caring about a pty.
In my former life I did a metric ton of using ssh to run remote commands under program control to provide secure remote access to programs/systems while minimizing the chance of intercept. Centralized security logging, for example. So the real question is not about ptys and scraping full screen programs. The real question is, can I get a filehandle for stdin, stdout, and stderr and then use the appropriate file I/O primitives to send data to the remote process and get data from the process. My guess is that, under the covers, 2!:2 is used to create the ssh co-process. The raw foreign doc says it returns filehandles that are bound to standard input, output and error. If you can't get what you want from the library, well, most of the foreign primitives are not so hard to use directly. Do remember that this sort of co-process creation is only supported on Unix. You may not care whether your program runs under android or Windows, but this makes it non-portable. Yes, I think it is a bad thing that Windows does not support the native Unix process structure as a standard optional thing. There was movement that way for a bit, but that was abandoned, I think. It might run under cygwin. On Mar 3, 2018 08:15, "Raul Miller" <rauldmil...@gmail.com> wrote: You are correct. There is a lot of OS specific code needed for PTYs, and most everyone has other higher priorities than working through all those issues. Thanks, -- Raul On Sat, Mar 3, 2018 at 6:30 AM, Omar Passos Torres de Almeida <omar...@gmail.com> wrote: > Thanks! > I know those technics, but i was thinking in something coded in pure J or > some addon. I think not exists something like those in J. > > Omar > > > On 03/02/2018 11:25 PM, Raul Miller wrote: >> >> Working with ptys is kind of tricky, you'll want a program that >> specializes in that, like expect or maybe even something like tmux. >> >> https://en.wikipedia.org/wiki/Expect >> >> https://en.wikipedia.org/wiki/Tmux >> >> If you're working with tmux, for example, you can use tmux send-keys >> to "type" things into your ssh session. >> https://ricochen.wordpress.com/2011/11/14/tmux-techniques-by-example/ >> looks like it has some plausible examples of this. >> >> I hope this helps, >> > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm