Python - forking an external process?

Roy Smith roy at panix.com
Wed Jul 3 00:17:05 EDT 2013


In article <14be21de-2ceb-464a-a638-dce0368ab9e7 at googlegroups.com>,
 Victor Hooi <victorhooi at gmail.com> wrote:

> Hi,
> 
> I have a Python script where I want to run fork and run an external command 
> (or set of commands).
> 
> For example, after doing <xyz>, I then want to run ssh to a host, handover 
> control back to the user, and have my script terminate.
> 
> Or I might want to run ssh to a host, less a certain textfile, then exit.
> 
> What's the idiomatic way of doing this within Python? Is it possible to do 
> with Subprocess?

I suspect you are trying to reinvent fabric.  It is designed to do 
exactly these things (in particular, handling all the really complicated 
stuff about ssh).

See http://docs.fabfile.org/



More information about the Python-list mailing list