[Twisted-Python] How to ... in Conch?

Konrads Smelkovs konrads.smelkovs at gmail.com
Sun Sep 9 08:53:53 EDT 2007


I seem to have figured it out. Attached is a module with function
executeCommand that executes a single command, gathers input, output and
error code and returns it.
Comment at will.


On 9/9/07, Konrads Smelkovs <konrads.smelkovs at gmail.com> wrote:
>
> Hello,
>
> How to obtain the stderror?
> chanel.SSHChannel has an interesting method extReceived, is it that?
>
> On 9/8/07, Paul Swartz <paulswartz at gmail.com > wrote:
> >
> > On 9/8/07, Konrads Smelkovs < konrads.smelkovs at gmail.com> wrote:
> > > 1) I want to invoke(exec) a command with arguments from a SSH Conch
> > client.
> > > The example suggests that arguments should be passed along with
> > command, so
> > > to invoke 'ls -l', one would pass common.NS('ls -l'). What to do about
> > > arguments that have spaces? Should I slash-escape them?
> >
> > Commands are executed with the -e argument of your shell.  You can
> > slash-escape spaces or quote them; either one should work.
> >
> > > 2) How to obtain the retcode from an exec'ed command?
> >
> > If the server supports it, it sends a 'exit-status' request to the
> > channel with a uint32 encoded exit code.  If it exits with a signal,
> > an 'exit-signal' message is sent with format:
> >     string signal name
> >     bool core dumped
> >     string error message
> >     string language
> >
> > HTH,
> > -p
> >
> > _______________________________________________
> > Twisted-Python mailing list
> > Twisted-Python at twistedmatrix.com
> > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> >
>
>
>
> --
> Konrads Smelkovs
> Applied IT sorcery.
>



-- 
Konrads Smelkovs
Applied IT sorcery.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20070909/e55282ed/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sshcommand.py
Type: text/x-python
Size: 3921 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20070909/e55282ed/attachment.py 


More information about the Twisted-Python mailing list