diff options
| author | Paul Eggert | 2018-05-21 12:30:09 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-05-21 12:31:54 -0700 |
| commit | 7b9fb7ace4357f1d630bf6b332eab34ae130ca44 (patch) | |
| tree | 47b72e21ef032b6a894a146587177e7c29cfded2 /test/src/process-tests.el | |
| parent | 79f15092b9d16631840cd42db034b787fae762ac (diff) | |
| download | emacs-7b9fb7ace4357f1d630bf6b332eab34ae130ca44.tar.gz emacs-7b9fb7ace4357f1d630bf6b332eab34ae130ca44.zip | |
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.
Diffstat (limited to 'test/src/process-tests.el')
| -rw-r--r-- | test/src/process-tests.el | 15 |
1 files changed, 14 insertions, 1 deletions
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 @@ | |||
| 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 | ;; Return t if OUTPUT could have been generated by merging the INPUTS somehow. | ||
| 185 | (defun process-tests--mixable (output &rest inputs) | ||
| 186 | (while (and output (let ((ins inputs)) | ||
| 187 | (while (and ins (not (eq (car (car ins)) (car output)))) | ||
| 188 | (setq ins (cdr ins))) | ||
| 189 | (if ins | ||
| 190 | (setcar ins (cdr (car ins)))) | ||
| 191 | ins)) | ||
| 192 | (setq output (cdr output))) | ||
| 193 | (not (apply #'append output inputs))) | ||
| 194 | |||
| 184 | (ert-deftest make-process/mix-stderr () | 195 | (ert-deftest make-process/mix-stderr () |
| 185 | "Check that `make-process' mixes the output streams if STDERR is nil." | 196 | "Check that `make-process' mixes the output streams if STDERR is nil." |
| 186 | (skip-unless (executable-find "bash")) | 197 | (skip-unless (executable-find "bash")) |
| @@ -200,7 +211,9 @@ | |||
| 200 | (accept-process-output process)) | 211 | (accept-process-output process)) |
| 201 | (should (eq (process-status process) 'exit)) | 212 | (should (eq (process-status process) 'exit)) |
| 202 | (should (eq (process-exit-status process) 0)) | 213 | (should (eq (process-exit-status process) 0)) |
| 203 | (should (equal (buffer-string) "stdout\nstderr\n"))))) | 214 | (should (process-tests--mixable (string-to-list (buffer-string)) |
| 215 | (string-to-list "stdout\n") | ||
| 216 | (string-to-list "stderr\n")))))) | ||
| 204 | 217 | ||
| 205 | (provide 'process-tests) | 218 | (provide 'process-tests) |
| 206 | ;; process-tests.el ends here. | 219 | ;; process-tests.el ends here. |