From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 12 15:48:10 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F4E01065672 for ; Fri, 12 Dec 2008 15:48:10 +0000 (UTC) (envelope-from rihad@mail.ru) Received: from mx28.mail.ru (mx28.mail.ru [194.67.23.67]) by mx1.freebsd.org (Postfix) with ESMTP id 3B78D8FC30 for ; Fri, 12 Dec 2008 15:48:10 +0000 (UTC) (envelope-from rihad@mail.ru) Received: from mx48.mail.ru (unknown [194.67.23.231]) by mx28.mail.ru (mPOP.Fallback_MX) with ESMTP id 4579C6108E for ; Fri, 12 Dec 2008 17:07:38 +0300 (MSK) Received: from [217.25.27.27] (port=9560 helo=[217.25.27.27]) by mx48.mail.ru with asmtp id 1LB8g4-000Ad6-00; Fri, 12 Dec 2008 17:07:36 +0300 Message-ID: <49427027.60800@mail.ru> Date: Fri, 12 Dec 2008 18:07:35 +0400 From: rihad User-Agent: Icedove 1.5.0.14eol (X11/20080724) MIME-Version: 1.0 To: Christoph Mallon References: <494235CA.2050101@mail.ru> <49426C40.6050802@gmx.de> In-Reply-To: <49426C40.6050802@gmx.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: Not detected X-Mras: OK X-Mailman-Approved-At: Fri, 12 Dec 2008 18:33:55 +0000 Cc: freebsd-hackers@freebsd.org Subject: Re: preventing FIFO from EOF X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 15:48:10 -0000 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)