[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Coproc usage ... not understanding
From: |
Linda Walsh |
Subject: |
Re: Coproc usage ... not understanding |
Date: |
Tue, 09 Aug 2011 17:47:09 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Gecko/20100228 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666 |
Bob Proulx wrote:
Chet Ramey wrote:
Linda Walsh wrote:
Ideas?
You're probably running into grep (and sort, and sed) buffering its
output. I haven't been able to figure out a way past that.
This may be a good point to mention this reference:
http://www.pixelbeat.org/programming/stdio_buffering/
And the 'stdbuf' command the came out of it.
http://www.gnu.org/software/coreutils/manual/html_node/stdbuf-invocation.html#stdbuf-invocation
Bob
====
Interesting -- it modifies the buffering on the command it invokes?
Does it only work with gnu programs? I.e. how would they know to not
buffer
their i/o? I'll have to try it with that and see if it affects the problem,
but given the size of the I/O buffs (4-8K?) I figured that the coproc
would have held all of the output (it was 3 lines out of a bunch), until I
closed it's stdin.
I don't think the stdbuf will help if the child has it's own input
pipe open...if it does, I can try closing it, but i just expected that to be
done automatically as with pipes...but maybe that was a step too far.
Thanks for the pointer!