This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: subprocess.Popen with copious output hangs
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: astrand Nosy List: astrand, neuhauser
Priority: normal Keywords:

Created on 2005-03-13 13:35 by neuhauser, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg24571 - (view) Author: neuhauser (neuhauser) Date: 2005-03-13 13:35
the following script works fine with modest amount of
output from the subprocess, but hangs with 23 kB of output:

import subprocess

c = subprocess.Popen (['svnlook', 'diff',
'/home/svn/repos', '-r', '57'],
                      stdin  = subprocess.PIPE,
                      stdout = subprocess.PIPE,
                      stderr = subprocess.STDOUT)
rc = c.wait ()
lines = [line.rstrip () for line in c.stdout.readlines ()]
if rc:
    raise Exception (lines)
print lines

r57 in the above subversion repository produces a diff
of just under 23 kB, and the code hangs in:

^CTraceback (most recent call last):
  File "/home/roman/tmp/scratch15", line 9, in ?
    rc = c.wait ()
  File "/usr/local/lib/python2.4/subprocess.py", line
1018, in wait
    pid, sts = os.waitpid(self.pid, 0)
KeyboardInterrupt

this is with 2.4 built from the ports on
FreeBSD isis.sigpipe.cz 4.10-STABLE FreeBSD 4.10-STABLE
#3: Sat Aug  7 16:06:48 CEST 2004 i386
msg24572 - (view) Author: Peter Åstrand (astrand) * (Python committer) Date: 2005-03-19 07:04
Logged In: YES 
user_id=344921

This is not a subprocess bug. You must read away the data
before wait() on the process. 
History
Date User Action Args
2022-04-11 14:56:10adminsetgithub: 41690
2005-03-13 13:35:26neuhausercreate