7
7stud
Hi,
What is the difference between:
1) getting the returncode directly from the subprocess object
2) calling poll() on the subprocess object?
Here is an example:
import subprocess
p = subprocess.Popen("ls", stdout=subprocess.PIPE)
print p.returncode
print p.poll()
print
print p.stdout.read()[:5]
print
print p.returncode
print p.poll()
print p.returncode
--output:--
None
None
10tes
None
0
0
What is the difference between:
1) getting the returncode directly from the subprocess object
2) calling poll() on the subprocess object?
Here is an example:
import subprocess
p = subprocess.Popen("ls", stdout=subprocess.PIPE)
print p.returncode
print p.poll()
print p.stdout.read()[:5]
print p.returncode
print p.poll()
print p.returncode
--output:--
None
None
10tes
None
0
0