popen4 hanging on write

R

rinkworks

I'm having trouble with Popen4 locking up on me. It appears to be
unrelated to the actual command I'm running, because I made the command
just "cat" (I'm on UNIX) to echo whatever input I sent it, and it's still
locking. The trick is, it works for small amounts of data. After roughly
1.5K of input, it locks up and will not write any more data to the pipe.
I assume a buffer got full somewhere, and it's blocking the write call.

Meanwhile, I can't read the output, because if I do that, that blocks,
too.

Anybody know how to resolve this problem? Here is my current code:

import popen2
pipe = popen2.Popen4("cat")
pipe.tochild.write(data)
pipe.tochild.close()
output = pipe.fromchild.read()
print output

Again, when data is just a few lines, it works, but not if it's maybe 1500
bytes or more. No documentation I can find addresses this problem; the
above is theoretically supposed to just work. I don't get it.

Thanks for any help anyone can give me.
 

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,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top