From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Using file descriptors in Emacs Date: Sun, 11 Sep 2016 20:13:29 +0300 Message-ID: <831t0qbbra.fsf@gnu.org> References: <1465262706-5229-1-git-send-email-sbaugh@catern.com> <87twfevqu7.fsf@earth.catern.com> <87pood5fee.fsf@earth.catern.com> <834m5p83yy.fsf@gnu.org> <877fal56zh.fsf@earth.catern.com> <83d1kcaowk.fsf@gnu.org> <8737l86glg.fsf@earth.catern.com> <837fakan8b.fsf@gnu.org> <87r38s4xmv.fsf@earth.catern.com> <83oa3w8byt.fsf@gnu.org> <87twdn25ib.fsf@earth.catern.com> <83d1kabgms.fsf@gnu.org> <87d1ka1l62.fsf@earth.catern.com> <8337l6bdcl.fsf@gnu.org> <87zinez85m.fsf@earth.catern.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1473614059 18694 195.159.176.226 (11 Sep 2016 17:14:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 11 Sep 2016 17:14:19 +0000 (UTC) Cc: emacs-devel@gnu.org To: sbaugh@catern.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 11 19:14:15 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bj8Kb-0004CQ-Nx for ged-emacs-devel@m.gmane.org; Sun, 11 Sep 2016 19:14:13 +0200 Original-Received: from localhost ([::1]:38462 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bj8KZ-0005Ti-ES for ged-emacs-devel@m.gmane.org; Sun, 11 Sep 2016 13:14:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bj8K2-0005Ta-WF for emacs-devel@gnu.org; Sun, 11 Sep 2016 13:13:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bj8Jx-0008EZ-VX for emacs-devel@gnu.org; Sun, 11 Sep 2016 13:13:37 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50626) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bj8Jx-0008EF-SN; Sun, 11 Sep 2016 13:13:33 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1302 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bj8Jv-0000Mn-H5; Sun, 11 Sep 2016 13:13:32 -0400 In-reply-to: <87zinez85m.fsf@earth.catern.com> (sbaugh@catern.com) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:207367 Archived-At: > From: sbaugh@catern.com > Date: Sun, 11 Sep 2016 12:57:25 -0400 > > > To me it sounds most natural. All of our APIs in this area are like > > that. > > OK, that works for me. I guess it's not really different from the API I > would have constructed for file descriptors. > > I can hack up some patches for this. Or maybe people have more thoughts > on the appropriate API first? Yes, I'd like to hear other opinions as well. The above sounds like a natural extension of what we've been doing in that department, but that doesn't mean there couldn't be alternative ideas. > > Btw, running a pipe of processes raises another issue, unrelated to > > file descriptors: we would need a way to make sure the processes do > > not start running until all the redirections are set up, otherwise > > some of them will die with SIGPIPE or somesuch. > > No, SIGPIPE will only happen when the read end of the pipe is no longer > open anywhere. If a process is writing to a pipe for which the read end > of the pipe has not yet been passed to a subprocess, that process will > just block, since we will still have the read end of the pipe open in > the Emacs process. We would only close the read end of the pipe after > forking, and the fork will make a copy of the read end of the pipe so it > will still be open even while the redirection is in process. That's not universally true, AFAIK.