From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: [PATCH 1/3] Document that 'make-process' mixes the output streams Date: Wed, 4 Apr 2018 14:02:16 +0200 Message-ID: <20180404120218.257212-1-phst@google.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1522843275 23357 195.159.176.226 (4 Apr 2018 12:01:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 4 Apr 2018 12:01:15 +0000 (UTC) Cc: Philipp Stephani To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 04 14:01:11 2018 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 1f3h6C-0005wA-UO for ged-emacs-devel@m.gmane.org; Wed, 04 Apr 2018 14:01:09 +0200 Original-Received: from localhost ([::1]:52879 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f3h8I-0002Jf-9Z for ged-emacs-devel@m.gmane.org; Wed, 04 Apr 2018 08:03:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40348) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f3h83-0002If-43 for emacs-devel@gnu.org; Wed, 04 Apr 2018 08:03:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f3h82-0000Ky-1K for emacs-devel@gnu.org; Wed, 04 Apr 2018 08:03:03 -0400 Original-Received: from mail-wr0-x22d.google.com ([2a00:1450:400c:c0c::22d]:46545) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f3h81-0000Jv-Qq for emacs-devel@gnu.org; Wed, 04 Apr 2018 08:03:01 -0400 Original-Received: by mail-wr0-x22d.google.com with SMTP id d1so22201966wrj.13 for ; Wed, 04 Apr 2018 05:03:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=iVex4EE40+391p+aDptqX0aBxGN2tle7+YKFKgWF8HU=; b=YuQacyUUoZJtwpmuXWWIYJVGYnul1vkGDpgZZg9tGG/Rp6MfSYo8HX0f3HWVnAheYy h0hYEY1q4azZDO22TpIYhdaxfn0wEZGb+qH/2hOAW1Ve5AKWxhxqkkL/EotTKQZ53Hu2 gKfy3d9RTJlv6csPvHPrv0Sggdh04WMg9yyzDesdwmReas+4GkJ59eX5ui+lSg97OL48 4TtL68l/rE64DFcxymU/80vlh+1wqIC7yynhk+8wtiSoooavRmDRMNapXM43QSStVbt+ xJh9TgeFF/6L3Z2FB3MB5uPdSiuPy/D5E486ctiWaoIMz6HxtUOwTGQJvk9eLAiYeQvD xqOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=iVex4EE40+391p+aDptqX0aBxGN2tle7+YKFKgWF8HU=; b=mzNGsu9Ld4nqz6Dnj50vMJCJeer1oYPh6SnZKSb8mDuZbPXNvRcemFBy7YgrejNjfN RT9U2mC6hlEeEAGtMjSE61BLqtYwEjm5STK5ep/AI8Z2u/0394g4cnM3nYqTHJkKZdJz uyfSQArAp21jhd6N58vSD2H1T4EOjy8zYcTRAMU0PjYoPKbSLre+QSz6zd/uxxE2muLb MR9rABxs64gBlYqqlWYRR4TyFi76caUhXQ1oZWVCVGco35HHKdByZBB1ZDo9kD2QB0qF sAA7X3bFmkDscSBLDFoZgy+pqbC+5pBJG++LqpaB61o7NEu3dTyAmY9s1odG1/MwTfDD 4qGg== X-Gm-Message-State: AElRT7Fz7uS9Nd/p7zJHG68wBkUJpIz8IsKRvq7UPp2nayY023rarox7 4EB+L5WYSwjYQ5IfbSTYs76zy0on X-Google-Smtp-Source: AIpwx4+KHTmHg+LQXbe+tEUuKxm51wF4ebqTUVJ+qt1QCwRTIP1rEv4AEmD3wPuLnHCb5mGwnouMfg== X-Received: by 10.223.220.77 with SMTP id m13mr11931340wrj.274.1522843380051; Wed, 04 Apr 2018 05:03:00 -0700 (PDT) Original-Received: from phst-glaptop.cm.cablesurf.de ([2001:4c50:25c:c900:2a16:adff:fe49:52c8]) by smtp.gmail.com with ESMTPSA id n143sm4848233wmd.29.2018.04.04.05.02.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Apr 2018 05:02:58 -0700 (PDT) X-Google-Original-From: Philipp Stephani X-Mailer: git-send-email 2.17.0.484.g0c8726318c-goog X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22d 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:224313 Archived-At: * doc/lispref/processes.texi (Asynchronous Processes): * src/process.c (Fmake_process): Document that standard error is mixed with standard output if STDERR is nil. * test/src/process-tests.el (make-process/mix-stderr): New unit test. --- doc/lispref/processes.texi | 4 +++- src/process.c | 3 ++- test/src/process-tests.el | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index af177e053c..3e26f57798 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi @@ -681,7 +681,9 @@ Asynchronous Processes @item :stderr @var{stderr} Associate @var{stderr} with the standard error of the process. A non-@code{nil} value should be either a buffer or a pipe process -created with @code{make-pipe-process}, described below. +created with @code{make-pipe-process}, described below. If +@var{stderr} is @code{nil}, standard error is mixed with standard +output, and both are sent to @var{buffer} or @var{filter}. @end table The original argument list, modified with the actual connection diff --git a/src/process.c b/src/process.c index ed2cab7b51..c357a8bdc3 100644 --- a/src/process.c +++ b/src/process.c @@ -1657,7 +1657,8 @@ to use a pty, or nil to use the default specified through :stderr STDERR -- STDERR is either a buffer or a pipe process attached to the standard error of subprocess. Specifying this implies -`:connection-type' is set to `pipe'. +`:connection-type' is set to `pipe'. If STDERR is nil, standard error +is mixed with standard output and sent to BUFFER or FILTER. usage: (make-process &rest ARGS) */) (ptrdiff_t nargs, Lisp_Object *args) diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 7d35560229..b1b4665c3c 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el @@ -181,5 +181,23 @@ process-test-sentinel-wait-function-working-p (should-not (process-query-on-exit-flag process)))) (kill-process process))))) +(ert-deftest make-process/mix-stderr () + "Check that ‘make-process’ mixes the output streams if STDERR is nil." + (skip-unless (executable-find shell-file-name)) + (with-temp-buffer + (let ((process (make-process + :name "mix-stderr" + :command (list shell-file-name shell-command-switch + "echo stdout; echo stderr >&2") + :buffer (current-buffer) + :sentinel #'ignore + :noquery t + :connection-type 'pipe))) + (while (process-live-p process) + (accept-process-output process)) + (should (eq (process-status process) 'exit)) + (should (eq (process-exit-status process) 0)) + (should (equal (buffer-string) "stdout\nstderr\n"))))) + (provide 'process-tests) ;; process-tests.el ends here. -- 2.17.0.484.g0c8726318c-goog