[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: preventing pipe reader from existing on writer exiting

From: Brian J. Murrell
Subject: Re: preventing pipe reader from existing on writer exiting
Date: Thu, 01 Oct 2009 11:28:14 -0400

On Wed, 2009-09-30 at 23:13 +0200, Andreas Schwab wrote:
> Just make sure the write side of the pipe is not closed prematurely.

Hrm.  Yes, of course.  John's solution of having a null writer keeping
it open is one way -- which I might just use.

> $ (n=0; while [ $n -lt 10 ]; do cat /dev/zero; let n=$n+1; done) > /tmp/fifo &

But this is where (simplified) my example using cat went sideways.  :-(
In my real world use, the first cat is actually mplayer and doesn't have
the option of writing to stdout instead of a named file for this
particular use of it.

So other than John's solution, I suppose I could still follow your
advice of not having the fifo write close prematurely and insulate the
writer from the fifo.  I can't think of another way other than using two
fifos with a cat between them.  Can anyone else?

FWIW, the actual process which the second cat is standing in for is
oggenc and it can take stdin, if that makes it any easier.  So to recap:

mplayer ... /tmp/fifo &
oggenc ... /tmp/fifo

The mplayer may terminate prematurely and need to be restarted, ideally
without oggenc knowing this.

Cheers and much thanx!


Attachment: signature.asc
Description: This is a digitally signed message part

reply via email to

[Prev in Thread] Current Thread [Next in Thread]