diff options
| author | Philipp Stephani | 2018-04-04 12:14:56 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2018-04-07 22:15:42 +0200 |
| commit | 8df23a82042fa7dbaaa4377bc376d705595b073f (patch) | |
| tree | 707eaddc19a76a72c39ae0481c8eea7ac93dda31 | |
| parent | 55525480780d34b2f968739249685d0c9e9a063f (diff) | |
| download | emacs-8df23a82042fa7dbaaa4377bc376d705595b073f.tar.gz emacs-8df23a82042fa7dbaaa4377bc376d705595b073f.zip | |
Document that 'make-process' mixes the output streams
* 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.
| -rw-r--r-- | doc/lispref/processes.texi | 4 | ||||
| -rw-r--r-- | src/process.c | 3 | ||||
| -rw-r--r-- | 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 af177e053cc..3e26f577982 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi | |||
| @@ -681,7 +681,9 @@ a default sentinel will be used, which can be overridden later. | |||
| 681 | @item :stderr @var{stderr} | 681 | @item :stderr @var{stderr} |
| 682 | Associate @var{stderr} with the standard error of the process. A | 682 | Associate @var{stderr} with the standard error of the process. A |
| 683 | non-@code{nil} value should be either a buffer or a pipe process | 683 | non-@code{nil} value should be either a buffer or a pipe process |
| 684 | created with @code{make-pipe-process}, described below. | 684 | created with @code{make-pipe-process}, described below. If |
| 685 | @var{stderr} is @code{nil}, standard error is mixed with standard | ||
| 686 | output, and both are sent to @var{buffer} or @var{filter}. | ||
| 685 | @end table | 687 | @end table |
| 686 | 688 | ||
| 687 | The original argument list, modified with the actual connection | 689 | The original argument list, modified with the actual connection |
diff --git a/src/process.c b/src/process.c index ed2cab7b51f..c357a8bdc33 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 | |||
| 1657 | 1657 | ||
| 1658 | :stderr STDERR -- STDERR is either a buffer or a pipe process attached | 1658 | :stderr STDERR -- STDERR is either a buffer or a pipe process attached |
| 1659 | to the standard error of subprocess. Specifying this implies | 1659 | to the standard error of subprocess. Specifying this implies |
| 1660 | `:connection-type' is set to `pipe'. | 1660 | `:connection-type' is set to `pipe'. If STDERR is nil, standard error |
| 1661 | is mixed with standard output and sent to BUFFER or FILTER. | ||
| 1661 | 1662 | ||
| 1662 | usage: (make-process &rest ARGS) */) | 1663 | usage: (make-process &rest ARGS) */) |
| 1663 | (ptrdiff_t nargs, Lisp_Object *args) | 1664 | (ptrdiff_t nargs, Lisp_Object *args) |
diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 7d355602297..849676ea8f0 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el | |||
| @@ -181,5 +181,23 @@ | |||
| 181 | (should-not (process-query-on-exit-flag process)))) | 181 | (should-not (process-query-on-exit-flag process)))) |
| 182 | (kill-process process))))) | 182 | (kill-process process))))) |
| 183 | 183 | ||
| 184 | (ert-deftest make-process/mix-stderr () | ||
| 185 | "Check that ‘make-process’ mixes the output streams if STDERR is nil." | ||
| 186 | (skip-unless (executable-find shell-file-name)) | ||
| 187 | (with-temp-buffer | ||
| 188 | (let ((process (make-process | ||
| 189 | :name "mix-stderr" | ||
| 190 | :command (list shell-file-name shell-command-switch | ||
| 191 | "echo stdout && echo stderr >&2") | ||
| 192 | :buffer (current-buffer) | ||
| 193 | :sentinel #'ignore | ||
| 194 | :noquery t | ||
| 195 | :connection-type 'pipe))) | ||
| 196 | (while (process-live-p process) | ||
| 197 | (accept-process-output process)) | ||
| 198 | (should (eq (process-status process) 'exit)) | ||
| 199 | (should (eq (process-exit-status process) 0)) | ||
| 200 | (should (equal (buffer-string) "stdout\nstderr\n"))))) | ||
| 201 | |||
| 184 | (provide 'process-tests) | 202 | (provide 'process-tests) |
| 185 | ;; process-tests.el ends here. | 203 | ;; process-tests.el ends here. |