I'm using python's subprocess
to run a python script (let's call it script2.py
), and that script is printing information to stdout
which is redirected using PIPE
. Problem is that script2.py
stops printing information but it keeps running in the background. What i want is to detect that state (when nothing is written to stdout
). Is there any way to do so?
I can simulate this behaviour with following:
script2.py
for i in range(0,1000):
if i < 500:
print "HUEHUE"
Next 500 iterations nothing will happen and that's what i need to detect in order to rerun the script.