diff options
| author | Noam Postavsky | 2019-07-24 20:33:18 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2019-07-25 18:36:03 -0400 |
| commit | b3e20737d83acbbbec372645e2a951293d84bd29 (patch) | |
| tree | 4db4e10154ddaf0e736275485f5ca9c5b5dfa1bd /test/src/process-tests.el | |
| parent | f67195028467e26348cab3a6cdc97034cd93f897 (diff) | |
| download | emacs-b3e20737d83acbbbec372645e2a951293d84bd29.tar.gz emacs-b3e20737d83acbbbec372645e2a951293d84bd29.zip | |
Fix subproc listening when setting filter to non-t (Bug#36591)
* src/process.c (Fset_process_filter): Call add_process_read_fd
according to the state of process filter before it's updated. This
restores the correct functioning as it was before 2016-02-16 "Allow
setting the filter masks later". Inline the set_process_filter_masks
call instead of fixing it that function, because it is also called
from connect_network_socket, and we don't want to change the behavior
of that function so close to release.
* test/src/process-tests.el (set-process-filter-t): New test.
Diffstat (limited to 'test/src/process-tests.el')
| -rw-r--r-- | test/src/process-tests.el | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 7cccc5a02cb..7a6762a9226 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el | |||
| @@ -144,6 +144,35 @@ | |||
| 144 | (should (equal "hello stderr!\n" | 144 | (should (equal "hello stderr!\n" |
| 145 | (mapconcat #'identity (nreverse stderr-output) ""))))) | 145 | (mapconcat #'identity (nreverse stderr-output) ""))))) |
| 146 | 146 | ||
| 147 | (ert-deftest set-process-filter-t () | ||
| 148 | "Test setting process filter to t and back." ;; Bug#36591 | ||
| 149 | (with-temp-buffer | ||
| 150 | (let* ((print-level nil) | ||
| 151 | (print-length nil) | ||
| 152 | (proc (start-process | ||
| 153 | "test proc" (current-buffer) | ||
| 154 | (concat invocation-directory invocation-name) | ||
| 155 | "-Q" "--batch" "--eval" | ||
| 156 | (prin1-to-string | ||
| 157 | '(let (s) | ||
| 158 | (while (setq s (read-from-minibuffer "$ ")) | ||
| 159 | (princ s) | ||
| 160 | (princ "\n"))))))) | ||
| 161 | (set-process-query-on-exit-flag proc nil) | ||
| 162 | (send-string proc "one\n") | ||
| 163 | (should | ||
| 164 | (accept-process-output proc 1)) ; Read "one". | ||
| 165 | (should (equal (buffer-string) "$ one\n$ ")) | ||
| 166 | (set-process-filter proc t) ; Stop reading from proc. | ||
| 167 | (send-string proc "two\n") | ||
| 168 | (should-not | ||
| 169 | (accept-process-output proc 1)) ; Can't read "two" yet. | ||
| 170 | (should (equal (buffer-string) "$ one\n$ ")) | ||
| 171 | (set-process-filter proc nil) ; Resume reading from proc. | ||
| 172 | (should | ||
| 173 | (accept-process-output proc 1)) ; Read "two" from proc. | ||
| 174 | (should (equal (buffer-string) "$ one\n$ two\n$ "))))) | ||
| 175 | |||
| 147 | (ert-deftest start-process-should-not-modify-arguments () | 176 | (ert-deftest start-process-should-not-modify-arguments () |
| 148 | "`start-process' must not modify its arguments in-place." | 177 | "`start-process' must not modify its arguments in-place." |
| 149 | ;; See bug#21831. | 178 | ;; See bug#21831. |