From owner-freebsd-hackers@freebsd.org Sat Jan 16 17:59:37 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F545A85B67 for ; Sat, 16 Jan 2016 17:59:37 +0000 (UTC) (envelope-from yuri@rawbw.com) Received: from shell1.rawbw.com (shell1.rawbw.com [198.144.192.42]) by mx1.freebsd.org (Postfix) with ESMTP id 0CCEC19CD for ; Sat, 16 Jan 2016 17:59:36 +0000 (UTC) (envelope-from yuri@rawbw.com) Received: from yuri.doctorlan.com (c-50-184-63-128.hsd1.ca.comcast.net [50.184.63.128]) (authenticated bits=0) by shell1.rawbw.com (8.15.1/8.15.1) with ESMTPSA id u0GHxZqD012892 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Sat, 16 Jan 2016 09:59:35 -0800 (PST) (envelope-from yuri@rawbw.com) X-Authentication-Warning: shell1.rawbw.com: Host c-50-184-63-128.hsd1.ca.comcast.net [50.184.63.128] claimed to be yuri.doctorlan.com Subject: Re: How to send EOF to the popen(3) pipe? To: "Montgomery-Smith, Stephen" , "freebsd-hackers@freebsd.org" References: <5699BAC9.3060407@rawbw.com> <5699C8AB.7070006@missouri.edu> From: Yuri Message-ID: <569A8508.80908@rawbw.com> Date: Sat, 16 Jan 2016 09:59:36 -0800 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <5699C8AB.7070006@missouri.edu> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 16 Jan 2016 17:59:37 -0000 On 01/15/2016 20:35, Montgomery-Smith, Stephen wrote: > Maybe I am displaying my ignorance. But wouldn't you do this by > invoking the function pclose? No, pclose kills the process and returns the exit code. Half-closed connection though can be alive for a while, until the other side finishes and closes the pipe. > My memory of using this was that this could gridlock because of > buffering. Suppose process A popens a process B. A sends a message to Gridlocks are possible if reads/writes are performed in the wrong order. But this is besides the point of the original question. I think the answer to my question is "no". popen(3) can't send EOF. Protocol needs to support EOF signal on the application-level. Yuri