Thanks very much Jean-Paul for your answer.
I will try to implement reactor.spawnProcess with this example.
Best Regards

2008/8/16 Jean-Paul Calderone <>
On Sat, 16 Aug 2008 14:04:22 +0200, The Noob <> wrote:
Hello all,
I try to implement a custom ssh server with twisted . I use* to
begin (* )
I would like to execute interactive scripts which are on my server. The
problem is theses scripts are interactives. How can I redirect IO on my
shell ?
For example, if I want to install a software with apt. I have questions to
install dependencies ( yes/no)
I start to create a definition for this function like def do_apt. And then
when in my custom shell I execute ( apt python)., that executes apt-get
install python on the server. But how can I redirect the output in my shell
to answer dependencies questions ?
Thanks for your help

To run a program like apt, you must be using `reactor.spawnProcess´.  That
means that you have two different protocol implementations.  One to talk
to the SSH connection (eg, `SSHDemoProtocol´ in the O'Reilly example) and
one to talk to the child process.

If you want output from the child process to show up in the SSH client, then
when the process protocol receives data from it, it should pass it on to the
SSH protocol to write to the client.  Similarly, if you want input from the
SSH client written to the stdin of the child process, when the SSH protocol
receives data it should pass it on to the process protocol to write to the
child process.

You'll have to keep track of what state your application is in to do this
correctly.  Input should only be handled this way when there is actually
a child process running.


Twisted-Python mailing list