From: Paul Eggert Date: Mon, 21 May 2018 19:30:09 +0000 (-0700) Subject: Don’t assume ordering in make-process/mix-stderr X-Git-Tag: emacs-27.0.90~5011 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7b9fb7ace4357f1d630bf6b332eab34ae130ca44;p=emacs.git 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. --- diff --git a/test/src/process-tests.el b/test/src/process-tests.el index e83a67290b2..551b34ff371 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el @@ -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.