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, 18 Mar 2015 18:25:34 +0200 Message-ID: <83egomxog1.fsf@gnu.org> References: <87d24d3uwz.fsf-ueno@gnu.org> <83pp87y6iu.fsf@gnu.org> <83mw3bxz9f.fsf@gnu.org> <83k2yfx8zi.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1426695964 14599 80.91.229.3 (18 Mar 2015 16:26:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 18 Mar 2015 16:26:04 +0000 (UTC) Cc: emacs-devel@gnu.org To: Daiki Ueno Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 18 17:25:52 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 1YYGn1-000796-Ks for ged-emacs-devel@m.gmane.org; Wed, 18 Mar 2015 17:25:51 +0100 Original-Received: from localhost ([::1]:34724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYGn1-0004kB-0E for ged-emacs-devel@m.gmane.org; Wed, 18 Mar 2015 12:25:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYGmx-0004k4-KX for emacs-devel@gnu.org; Wed, 18 Mar 2015 12:25:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YYGmt-0000oJ-DV for emacs-devel@gnu.org; Wed, 18 Mar 2015 12:25:47 -0400 Original-Received: from mtaout27.012.net.il ([80.179.55.183]:51582) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYGmt-0000o1-5S; Wed, 18 Mar 2015 12:25:43 -0400 Original-Received: from conversion-daemon.mtaout27.012.net.il by mtaout27.012.net.il (HyperSendmail v2007.08) id <0NLF00O0015OAN00@mtaout27.012.net.il>; Wed, 18 Mar 2015 18:20:23 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout27.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NLF00D9D1DZ18B0@mtaout27.012.net.il>; Wed, 18 Mar 2015 18:20:23 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.179.55.183 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:183998 Archived-At: > From: Daiki Ueno > Date: Wed, 18 Mar 2015 16:37:08 +0900 > > >> In any case, supporting stderr could be a starting point, as it seems to > >> be a long-standing request: > >> https://lists.gnu.org/archive/html/emacs-devel/2004-04/msg01051.html > >> and it wouldn't involve a portability issue. > > > > Redirecting the child's stderr is already supported on Windows, so > > this is only a matter of having the higher layers DTRT. > > So, let's start with small (but common) things. The attached patch adds > a new keyword `:stderr' to `make-process'. The argument can be either a > buffer or a (newly introduced) pipe process. Do you expect this to work on Windows? If so, then there's at least some part of "having higher layers DTRT" I failed to adequately explain ;-) Redirection of stderr does indeed work on the lowest level of creating subprocesses on MS-Windows, but we don't expect to read from a pipe connected to child's stderr, and thus the 'pselect' emulation watches only one file handle per sub-process. This needs to be expanded. In addition, this: > (let ((stderr (make-pipe-process :name "stderr"))) > (make-process :name "test" > :buffer (current-buffer) > :command (list (expand-file-name "./test.sh")) > :stderr stderr) > (set-process-filter stderr ...)) introduces a new concept whereby a process object ('stderr' in this case) can be passed to another subprocess, which AFAIK was not possible until now, at least not on MS-Windows. Volunteers are welcome to work on this, of course.