[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] Problem with printing 5000 lines to a coprocess
From: |
Andrew J. Schorr |
Subject: |
Re: [bug-gawk] Problem with printing 5000 lines to a coprocess |
Date: |
Mon, 22 Dec 2014 09:52:25 -0500 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Hi,
On Mon, Dec 22, 2014 at 12:24:29PM -0200, Hermann Peifer wrote:
> On 2014-12-21 12:50, Andrew J. Schorr wrote:
> >
> >Hmmm. The "pty" trick is just a way to solve the flushing problem.
>
> Which is exactly the one I wanted to solve, as the flushing problem made my
> initial code (send 1 line, then read 1 result) either hang or terribly slow
> (after forcing the coprocess to flush its output via close().
>
> Another "trick" would be to use a 2-way pipe and request line-buffering like
> this, as I learned from [0]:
> command = "stdbuf -o L " subprogram
Thanks for the tip; I was not familiar with the stdbuf program. That's
a clever hack to use LD_PRELOAD to fix the buffering, and it should certainly
perform a bit better than using ptys, as you noted. Of course, it depends
on the application's using stdio for its output. In most cases, that's
an OK assumption.
I have almost always used coprocesses that I've written myself, and in such
cases, I add a command-line option to force line-buffering.
Regards,
Andy
- [bug-gawk] Problem with printing 5000 lines to a coprocess, Hermann Peifer, 2014/12/20
- Re: [bug-gawk] Problem with printing 5000 lines to a coprocess, Andrew J. Schorr, 2014/12/20
- Re: [bug-gawk] Problem with printing 5000 lines to a coprocess, Hermann Peifer, 2014/12/20
- Re: [bug-gawk] Problem with printing 5000 lines to a coprocess, Andrew J. Schorr, 2014/12/20
- Re: [bug-gawk] Problem with printing 5000 lines to a coprocess, Hermann Peifer, 2014/12/20
- Re: [bug-gawk] Problem with printing 5000 lines to a coprocess, Andrew J. Schorr, 2014/12/21
- Re: [bug-gawk] Problem with printing 5000 lines to a coprocess, Hermann Peifer, 2014/12/22
- Re: [bug-gawk] Problem with printing 5000 lines to a coprocess,
Andrew J. Schorr <=
- Re: [bug-gawk] Problem with printing 5000 lines to a coprocess, Aharon Robbins, 2014/12/24
- Re: [bug-gawk] Problem with printing 5000 lines to a coprocess, Andrew J. Schorr, 2014/12/24