Popen pipe hang

S

schickb

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.stdout)
arr.tofile(src.stdin)
src.stdin.close()
dst.wait()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top