unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 1/3] Document that 'make-process' mixes the output streams
@ 2018-04-04 12:02 Philipp Stephani
  2018-04-04 12:02 ` [PATCH 2/3] Don't print "process finished" into the stderr buffer Philipp Stephani
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Philipp Stephani @ 2018-04-04 12:02 UTC (permalink / raw)
  To: emacs-devel; +Cc: Philipp Stephani

* 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




^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2019-04-22 15:52 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-04 12:02 [PATCH 1/3] Document that 'make-process' mixes the output streams Philipp Stephani
2018-04-04 12:02 ` [PATCH 2/3] Don't print "process finished" into the stderr buffer Philipp Stephani
2018-04-04 13:14   ` Eli Zaretskii
2018-04-07 20:21     ` Philipp Stephani
2018-04-08 13:13       ` Eli Zaretskii
2018-04-10  4:14         ` Stephen Leake
2018-04-10  4:59           ` Eli Zaretskii
2019-04-19 19:28         ` Philipp Stephani
2019-04-20  7:30           ` Eli Zaretskii
2019-04-21 13:55             ` Philipp Stephani
2019-04-21 19:09               ` Eli Zaretskii
2019-04-21 20:57             ` Stefan Monnier
2019-04-22  9:37               ` Eli Zaretskii
2019-04-22 14:43                 ` Stefan Monnier
2019-04-22 15:23                   ` Eli Zaretskii
2019-04-22 15:45                     ` Philipp Stephani
2019-04-22 15:52                       ` Eli Zaretskii
2018-04-04 12:02 ` [PATCH 3/3] Inherit process output coding system to stderr process Philipp Stephani
2018-04-04 13:39   ` Eli Zaretskii
2018-04-07 21:12     ` Philipp Stephani
2018-04-08 13:18       ` Eli Zaretskii
2018-04-08 16:39         ` Eli Zaretskii
2018-04-04 13:12 ` [PATCH 1/3] Document that 'make-process' mixes the output streams Eli Zaretskii
2018-04-07 20:18   ` Philipp Stephani

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).