mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-31 20:02:42 +00:00
Don’t assume ordering in make-process/mix-stderr
* test/src/process-tests.el (process-tests--mixable): New function. (make-process/mix-stderr): Don’t assume stdout is merged before stderr. POSIX does not require this, and the assumption failed to hold on my Fedora 28 platform. See Bug#31214.
This commit is contained in:
parent
79f15092b9
commit
7b9fb7ace4
@ -181,6 +181,17 @@
|
||||
(should-not (process-query-on-exit-flag process))))
|
||||
(kill-process process)))))
|
||||
|
||||
;; Return t if OUTPUT could have been generated by merging the INPUTS somehow.
|
||||
(defun process-tests--mixable (output &rest inputs)
|
||||
(while (and output (let ((ins inputs))
|
||||
(while (and ins (not (eq (car (car ins)) (car output))))
|
||||
(setq ins (cdr ins)))
|
||||
(if ins
|
||||
(setcar ins (cdr (car ins))))
|
||||
ins))
|
||||
(setq output (cdr output)))
|
||||
(not (apply #'append output inputs)))
|
||||
|
||||
(ert-deftest make-process/mix-stderr ()
|
||||
"Check that `make-process' mixes the output streams if STDERR is nil."
|
||||
(skip-unless (executable-find "bash"))
|
||||
@ -200,7 +211,9 @@
|
||||
(accept-process-output process))
|
||||
(should (eq (process-status process) 'exit))
|
||||
(should (eq (process-exit-status process) 0))
|
||||
(should (equal (buffer-string) "stdout\nstderr\n")))))
|
||||
(should (process-tests--mixable (string-to-list (buffer-string))
|
||||
(string-to-list "stdout\n")
|
||||
(string-to-list "stderr\n"))))))
|
||||
|
||||
(provide 'process-tests)
|
||||
;; process-tests.el ends here.
|
||||
|
Loading…
Reference in New Issue
Block a user