From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Add facility to collect stderr of async subprocess Date: Wed, 08 Apr 2015 09:17:21 +0300 Message-ID: <83r3rvgn4e.fsf@gnu.org> References: <87d24d3uwz.fsf-ueno@gnu.org> <83pp87y6iu.fsf@gnu.org> <83mw3bxz9f.fsf@gnu.org> <83k2yfx8zi.fsf@gnu.org> <83egomxog1.fsf@gnu.org> <83ego5tjgt.fsf@gnu.org> <877ftno4fr.fsf-ueno@gnu.org> <55247A98.5020302@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1428473861 16566 80.91.229.3 (8 Apr 2015 06:17:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 8 Apr 2015 06:17:41 +0000 (UTC) Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org To: Daiki Ueno Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 08 08:17:32 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YfjIp-0006xN-99 for ged-emacs-devel@m.gmane.org; Wed, 08 Apr 2015 08:17:31 +0200 Original-Received: from localhost ([::1]:50736 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfjIo-0006JN-Ct for ged-emacs-devel@m.gmane.org; Wed, 08 Apr 2015 02:17:30 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51259) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfjIb-0006J7-Ak for emacs-devel@gnu.org; Wed, 08 Apr 2015 02:17:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YfjIY-0007O9-5L for emacs-devel@gnu.org; Wed, 08 Apr 2015 02:17:17 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:64325) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfjIX-0007Nr-TD; Wed, 08 Apr 2015 02:17:14 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0NMH00K005EWEQ00@a-mtaout22.012.net.il>; Wed, 08 Apr 2015 09:17:12 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NMH00KWD5GN8B70@a-mtaout22.012.net.il>; Wed, 08 Apr 2015 09:17:12 +0300 (IDT) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.172 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:185134 Archived-At: > From: Daiki Ueno > Date: Wed, 08 Apr 2015 11:55:17 +0900 > Cc: emacs-devel@gnu.org > > I updated the patch and it's now much simpler. Thanks. I'm not sure I'm following this bit: > + if (emacs_pipe (p->open_fd + SUBPROCESS_STDIN) != 0 > + || emacs_pipe (p->open_fd + READ_FROM_SUBPROCESS) != 0) > + report_file_error ("Creating pipe", Qnil); > + outchannel = p->open_fd[WRITE_TO_SUBPROCESS]; > + inchannel = p->open_fd[READ_FROM_SUBPROCESS]; > + > + fcntl (inchannel, F_SETFL, O_NONBLOCK); > + fcntl (outchannel, F_SETFL, O_NONBLOCK); > + > +#ifdef WINDOWSNT > + register_aux_fd (inchannel, outchannel); > +#endif The function register_aux_fd records both of its arguments in the fd_info[] array. Why do we need to record outchannel? We never watch on MS-Windows the descriptors used to write to the subprocesses, and all the writes to them are made from the man thread. E.g., register_child only registers a single file descriptor. Why do we need to record two in this case? (If you worry about losing it, then don't: they are both recorded in the process object.) What am I missing? Thanks.