Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Dec 2008 18:07:35 +0400
From:      rihad <rihad@mail.ru>
To:        Christoph Mallon <christoph.mallon@gmx.de>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: preventing FIFO from EOF
Message-ID:  <49427027.60800@mail.ru>
In-Reply-To: <49426C40.6050802@gmx.de>
References:  <494235CA.2050101@mail.ru> <49426C40.6050802@gmx.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Christoph Mallon wrote:
> rihad schrieb:
>> $ mkfifo /var/tmp/foo
>> $ buffer -i /var/tmp/foo                    # misc/buffer
>> # in another console:
>> $ echo hi > /var/tmp/foo
>>
>> buffer prints hi and exits. I want it to keep reading and printing 
>> indefinitely.
>>
>> Further experimentation revealed that I need two writers: one dummy 
>> writer that just keeps /var/tmp/foo open for writing, and the other 
>> doing the "real work". This way buffer wouldn't exit. But how to 
>> emulate the dummy writer? It itself needs to block on something to 
>> keep /var/tmp/foo open. Any clean way to do this in shell? Maybe the 
>> solution is quite simple but isn't at the tip of my tongue.
> 
> Maybe "tail -f" is what you are looking for.
> 
> 
You mean in place of buffer? buffer is there for a reason (so that 
writers never block).

Something as simple as this:
$ sh < /dev/null > /var/tmp/kick 2>/dev/null
seems to block indefinitely, but exits as soon as I run
$ buffer -i /var/tmp/foo
(and buffer exits too)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?49427027.60800>