theclapp

Search theclapp.blog-city.com

 

Listener shell infrastructure III

posted Thursday, 19-Apr-2007
Using clisp as my remote agent and just sending it Lisp commands over its *standard-input*, and modifying the Lispworks listener to treat a backslash differently, I got this working:
CL-USER 215 > :on tmr
TMR

CL-USER 215 > (run-remote-command "ls -l .zshrc")
-rwxr-xr-x 1 clappl tivadm 25712 Apr 11 16:10 .zshrc
0

CL-USER 216 > \ls -l .zshrc
-rwxr-xr-x 1 clappl tivadm 25712 Apr 11 16:10 .zshrc
0

CL-USER 217 > :x
Closing connection to TMR
T

CL-USER 217 >

This looks like it may just be ready for some light production usage (which, no doubt, will immediatly shake out many fundamental bugs, like that I've still yet to implement "cd" on the remote agent).

The fun really begins when I can say something like

CL-USER 218 > \ls | (each line (do-something-with line))
The plumbing for that will take a little more doing, I think. I'll have to actually parse the input line, instead of just reading up to the first newline. Ideally, in
\p1 | p2 | p3 | (lisp1) | p4 | (lisp2) | p5
the p1 | p2 | p3 pipeline would run all on the server, and the output of p3 would come back, to be processed by (lisp1), whose output would go back to the input of p4, which sends its output back to be processed by (lisp2), which sends its output back to the input of p5, whose output comes back to our Listener. To pull all that off I'll have to get chummy with Lispworks threading, and do some kind of select loop on the remote agent, since it'll be reading six input streams: input of p1, and outputs of p3, lisp1, p4, lisp2, and p5. (Actually I'll ignore the input to p1 for a while, so really it's only five input streams.)

tags:        

links: digg this    del.icio.us    technorati    reddit