import subprocess p = subprocess.Popen("ls -R ./", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) p.wait()
This subprocess (listing directories recursively) produces a lot of output and therefore blocks when nobody "collects" it from stderr and stdin. In the shell "ls -R" takes a few seconds and is done. Above code results in a deadlock.
import subprocess Popen(" ls -R ./", shell=True, stdin=subproces s.PIPE, stdout= subprocess. PIPE, stderr= subprocess. PIPE, close_fds=True)
p = subprocess.
p.wait()
This subprocess (listing directories recursively) produces a lot of output and therefore blocks when nobody "collects" it from stderr and stdin. In the shell "ls -R" takes a few seconds and is done. Above code results in a deadlock.