Open GoogleCodeExporter opened 9 years ago
Seems to behave the same for me, but this particular case seems to just be a
complicated way to do os.system('ping -c 2 em32.net'). Do you have a use for
subprocess that can't be simulated with os.system?
Original comment by nml...@gmail.com
on 25 Jul 2009 at 11:28
I'd like to use the subprocess module to watch the run time of a program, and
kill it
if it runs for too long. Something like this:
p = subprocess.Popen(cmd)
start = time.time()
while (time.time() - start < 10):
p.poll()
if (p.returncode != None):
doSomething()
break
sleep(0.5)
else:
print("Error: cmd didn't finish in 10 seconds")
As far as I know, this can't be simulated with os.system
Original comment by eminence@gmail.com
on 27 Jul 2009 at 12:12
Original issue reported on code.google.com by
eminence@gmail.com
on 21 Jul 2009 at 5:55