emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 7b9fb7a: Don’t assume ordering in make-process/mix


From: Paul Eggert
Subject: [Emacs-diffs] master 7b9fb7a: Don’t assume ordering in make-process/mix-stderr
Date: Mon, 21 May 2018 15:31:59 -0400 (EDT)

branch: master
commit 7b9fb7ace4357f1d630bf6b332eab34ae130ca44
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    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.
---
 test/src/process-tests.el | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/test/src/process-tests.el b/test/src/process-tests.el
index e83a672..551b34f 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]