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

Paul Swartz paulswartz at gmail.com
Sat Sep 8 08:39:58 MDT 2007


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




More information about the Twisted-Python mailing list