Python - forking an external process?

Antoon Pardon antoon.pardon at rece.vub.ac.be
Wed Jul 3 06:55:55 EDT 2013


Op 03-07-13 05:47, Victor Hooi schreef:
> 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?
>

If I understand correctly that you want something done in python and then wish to finish
python and give control to an other program. I would use an external script that would
first launch the python program and then the other program.

If for some reason this is a less attractive option, you can use the os.exec family.
That terminates the python program will starting up an other program.

-- 
Antoon Pardon




More information about the Python-list mailing list