<div dir="ltr">Thanks very much Jean-Paul for your answer.<br>I will try to implement reactor.spawnProcess with this example.<br>Best Regards<br>TheNoob06<br><br><div class="gmail_quote">2008/8/16 Jean-Paul Calderone <span dir="ltr">&lt;<a href="mailto:exarkun@divmod.com">exarkun@divmod.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="Wj3C7c">On Sat, 16 Aug 2008 14:04:22 +0200, The Noob &lt;<a href="mailto:thenoob06@gmail.com" target="_blank">thenoob06@gmail.com</a>&gt; wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello all,<br>
I try to implement a custom ssh server with twisted . I use* sshserver.py to<br>
begin (* <a href="http://www.devshed.com/c/a/Python/SSH-with-Twisted/" target="_blank">http://www.devshed.com/c/a/Python/SSH-with-Twisted/</a> )<br>
I would like to execute interactive scripts which are on my server. The<br>
problem is theses scripts are interactives. How can I redirect IO on my<br>
shell ?<br>
For example, if I want to install a software with apt. I have questions to<br>
install dependencies ( yes/no)<br>
I start to create a definition for this function like def do_apt. And then<br>
when in my custom shell I execute ( apt python)., that executes apt-get<br>
install python on the server. But how can I redirect the output in my shell<br>
to answer dependencies questions ?<br>
Thanks for your help<br>
</blockquote>
<br></div></div>
To run a program like apt, you must be using `reactor.spawnProcess´. &nbsp;That<br>
means that you have two different protocol implementations. &nbsp;One to talk<br>
to the SSH connection (eg, `SSHDemoProtocol´ in the O&#39;Reilly example) and<br>
one to talk to the child process.<br>
<br>
If you want output from the child process to show up in the SSH client, then<br>
when the process protocol receives data from it, it should pass it on to the<br>
SSH protocol to write to the client. &nbsp;Similarly, if you want input from the<br>
SSH client written to the stdin of the child process, when the SSH protocol<br>
receives data it should pass it on to the process protocol to write to the<br>
child process.<br>
<br>
You&#39;ll have to keep track of what state your application is in to do this<br>
correctly. &nbsp;Input should only be handled this way when there is actually<br>
a child process running.<br>
<br>
Jean-Paul<br>
<br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com" target="_blank">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</blockquote></div><br></div>