Asychronous execution *with* return codes?

utabintarbo utabintarbo at gmail.com
Thu Oct 5 08:33:04 EDT 2006


I hope I have not overlooked a solution already posted, but I seem to
be unable to suss out a way to achieve both multiple console-less
executions of a given (console) application and gathering the return
code from the application.

What I have found:
<code>
import subprocess

# gives back return code, but does not run asynchronously
retcode = subprocess.call([app, lstArgs])
retcode = subprocess.Popen([app] + lstArgs).wait()
# runs the app async, but only returns the pid (no return code)
pid = subprocess.Popen([app] + lstArgs).pid
</code>

Is there some magic elixir which will get me both?

TIA




More information about the Python-list mailing list