python - Is there a way to check if a subprocess is still running? -


i'm launching number of subprocesses subprocess.popen in python. i'd check whether 1 such process has completed. i've found 2 ways of checking status of subprocess, both seem force process complete. 1 using process.communicate() , printing returncode, explained here. calling process.wait() , checking returns 0.

is there way check if process still running without waiting complete if is?

ouestion: ... way check if process still running ...

you can instance:

p = subprocess.popen(... """ none value indicates process hasn't terminated yet. """ poll = p.poll() if poll == none:   # p.subprocess alive 

python » 3.6.1 documentation popen-objects

tested python:3.4.2


Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to provide dependency injections in Eclipse RCP 3.x? -