get pid of a nohup command in Python
Gabriel Genellina
gagsl-py at yahoo.com.ar
Tue Feb 13 00:52:29 EST 2007
More information about the Python-list mailing list
Tue Feb 13 00:52:29 EST 2007
- Previous message (by thread): get pid of a nohup command in Python
- Next message (by thread): Weekly Python Patch/Bug Summary
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
En Tue, 13 Feb 2007 01:52:57 -0300, <g.willgoose at telluricresearch.com> escribió: > I'm new to Python and am evaluating moving a project from Tcl/Tk to > Python and am stuck on one issue. How can I nohup (or any detached > task for that matter) a process and get its PID in Python. The obvious > route of (with a trivial example) > > os.system("nohup ls > junk &") > > returns the status of the command execution (ie. 0). I wish to get the > PID output of the command (e.g. 16617). All the other commands spawn** > also seem to return the execution status not the PID. This is a > showstopper so any help appreciated. The spawn* family will return the pid if you use the P_NOWAIT flag. But the best way is to use the subprocess module; Popen objects have a pid attribute. http://docs.python.org/lib/module-subprocess.html -- Gabriel Genellina
- Previous message (by thread): get pid of a nohup command in Python
- Next message (by thread): Weekly Python Patch/Bug Summary
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list