From owner-freebsd-hackers@FreeBSD.ORG Fri Dec 12 13:47:20 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 177C01065677 for ; Fri, 12 Dec 2008 13:47:20 +0000 (UTC) (envelope-from rihad@mail.ru) Received: from mx39.mail.ru (mx39.mail.ru [194.67.23.35]) by mx1.freebsd.org (Postfix) with ESMTP id C80AD8FC0C for ; Fri, 12 Dec 2008 13:47:19 +0000 (UTC) (envelope-from rihad@mail.ru) Received: from [217.25.27.27] (port=53078 helo=[217.25.27.27]) by mx39.mail.ru with asmtp id 1LB8MP-0009X0-00; Fri, 12 Dec 2008 16:47:17 +0300 Message-ID: <49426B64.1070004@mail.ru> Date: Fri, 12 Dec 2008 17:47:16 +0400 From: rihad User-Agent: Icedove 1.5.0.14eol (X11/20080724) MIME-Version: 1.0 To: Danny Braniss References: <494235CA.2050101@mail.ru> In-Reply-To: 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:37 +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 13:47:20 -0000 Danny Braniss wrote: >> $ 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. >> >> Thanks. > > too easy > n csh: > while 1 > buffer -i /var/tmp/foo > end > or in sh: > while true; do > buffer -i /var/tmp/foo > done > > Thanks, but I should have said that buffer must always run to never miss any data. The reason being that buffer's output gets fed into another program that shouldn't be restarted.