Re: [vox-tech] writing to a shell instance

2011-10-27 Thread Norm Matloff
Thanks for all the suggestions, everyone! I should mention the application: A debugging tool for R (written in Python). R's internal debugging facilities are primitive, limited and clunky, a lack that my program is intended to remedy. For example, R's own debugger doesn't have conditional

Re: [vox-tech] writing to a shell instance

2011-10-26 Thread Bruce Wolk
On 10/26/2011 03:34 PM, Norm Matloff wrote: Here's what I'd like to do. I'm running code, in this case Python, in xterm A (replace by your favorite terminal emulator), and want that code to write to xterm B, just as if I had typed directly into xterm B. Say for example I want to run the ls

Re: [vox-tech] writing to a shell instance

2011-10-26 Thread Harold Lee
You could do this at an X11 level, e.g. http://www.doctort.org/adam/nerd-notes/x11-fake-keypress-event.html This tool looks promising also, but I haven't tried it: http://www.semicomplete.com/projects/xdotool/ I think you'd need to use some Windows API to do this there. Harold On Wed, Oct

Re: [vox-tech] writing to a shell instance

2011-10-26 Thread Bill Broadley
On 10/26/2011 04:20 PM, Bruce Wolk wrote: As for question 1, backticks are what you want: echo `ls` /dev/pts/8 Er, that's running a command in the original window and sending the output to the second window, which isn't what was asked for. Not to mention being rather confusing. The output

Re: [vox-tech] writing to a shell instance

2011-10-26 Thread Bill Broadley
On 10/26/2011 03:34 PM, Norm Matloff wrote: Here's what I'd like to do. I'm running code, in this case Python, in xterm A (replace by your favorite terminal emulator), and want that code to write to xterm B, just as if I had typed directly into xterm B. Say for example I want to run the

Re: [vox-tech] writing to a shell instance

2011-10-26 Thread Bill Broadley
I was wondering if I could get this down to just a few lines of code then realized that the shell should be able to handle this. Turns out it works okay. In terminal a: $ while /bin/true; do echo date; sleep 1; done | nc localhost In terminal b I run: ( nc -d -l cat) | bash And

Re: [vox-tech] writing to a shell instance

2011-10-26 Thread Ken Bloom
You would think that you could write to /dev/$PID/fd/0 and have that be the input into bash, but you can't. ttys are wierd. Xterm uses the Unix 98 pseudo terminal interface to talk to its child process using a /dev/pts/something device file. It calls open(/dev/ptmx) which is the single Unix 98

Re: [vox-tech] writing to a shell instance

2011-10-26 Thread Ken Bloom
On Wed, Oct 26, 2011 at 10:39 PM, Ken Bloom kbl...@gmail.com wrote: You would think that you could write to /dev/$PID/fd/0 and have that be the input into bash, but you can't. ttys are wierd. Xterm uses the Unix 98 pseudo terminal interface to talk to its child process using a