Popen pipe hang

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

    Popen pipe hang

    I'm trying to pipe data that starts life in an array('B') object
    through several processes. The code below is a simplified example. The
    data makes it through, but the wait() always hangs. Is there a better
    way to indicate src.stdin has reach EOF?

    from subprocess import Popen, PIPE
    from array import array

    arr = array('B')
    arr.fromstring( "hello\n")

    src = Popen( ["cat"], stdin=PIPE, stdout=PIPE)
    dst = Popen( ["cat"], stdin=src.stdou t)
    arr.tofile(src. stdin)
    src.stdin.close ()
    dst.wait()
Working...