How to extract the stdout of the executed command when I use waitpid() during subprocess.Popen()?
p = subprocess.Popen(['ls'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
retcode = os.waitpid(p.pid, 0)[1]
When I use,
p.communicate()
it returns empty ('','')
ok, I use it like this now:
p = subprocess.Popen(['ls'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
err = p.stderr.read()
retcode = os.waitpid(p.pid, 0)[1]