Re: subprocess.Popen hangs at times?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Christian Heimes

    Re: subprocess.Popen hangs at times?

    Kenneth McDonald wrote:
    When making calls of the form Popen(cmd, shell=True,
    stdout=subproce ss.PIPE), we've been getting occasional, predictable
    hangs. Will Popen accumulate a certain amount of stdout and then block
    until its read? We don't want to use threads, so just want to read the
    entire stdout after the subprocess has finished.
    The subprocess module has already an API method for your use case. The
    communicate() method of a subprocess.Pope n instance takes an optional
    stdin string and returns the stdout and stderr output as strings. The
    method uses the best low level functions possible (select() on Unix,
    threads on Windows).

    Christian

Working...