From: Michael Albinus Date: Thu, 14 Oct 2021 12:32:47 +0000 (+0200) Subject: Accept process-filter t in Tramp X-Git-Tag: emacs-28.0.90~288 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9ff6999a060244c7726752f5cb07e8c8d1218f41;p=emacs.git Accept process-filter t in Tramp * lisp/net/tramp.el (tramp-handle-make-process): * lisp/net/tramp-adb.el (tramp-adb-handle-make-process): * lisp/net/tramp-sh.el (tramp-sh-handle-make-process): Filter can be t. * test/lisp/net/tramp-tests.el (tramp-test29-start-file-process) (tramp-test30-make-process): Test filter equal t. --- diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 63ffb2d057b..6d8bed1d786 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -947,7 +947,7 @@ implementation will be used." (setq connection-type 'pty)) (unless (memq connection-type '(nil pipe pty)) (signal 'wrong-type-argument (list #'symbolp connection-type))) - (unless (or (null filter) (functionp filter)) + (unless (or (null filter) (eq filter t) (functionp filter)) (signal 'wrong-type-argument (list #'functionp filter))) (unless (or (null sentinel) (functionp sentinel)) (signal 'wrong-type-argument (list #'functionp sentinel))) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 8fa53cb5a23..6984dd8b429 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2785,7 +2785,7 @@ implementation will be used." (setq connection-type 'pty)) (unless (memq connection-type '(nil pipe pty)) (signal 'wrong-type-argument (list #'symbolp connection-type))) - (unless (or (null filter) (functionp filter)) + (unless (or (null filter) (eq filter t) (functionp filter)) (signal 'wrong-type-argument (list #'functionp filter))) (unless (or (null sentinel) (functionp sentinel)) (signal 'wrong-type-argument (list #'functionp sentinel))) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index a8ae71b147c..318b4e454da 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -4141,7 +4141,7 @@ substitution. SPEC-LIST is a list of char/value pairs used for (setq connection-type 'pty)) (unless (memq connection-type '(nil pipe pty)) (signal 'wrong-type-argument (list #'symbolp connection-type))) - (unless (or (null filter) (functionp filter)) + (unless (or (null filter) (eq filter t) (functionp filter)) (signal 'wrong-type-argument (list #'functionp filter))) (unless (or (null sentinel) (functionp sentinel)) (signal 'wrong-type-argument (list #'functionp sentinel))) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index ebedbaf45f2..da15401be05 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4562,6 +4562,24 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ;; Cleanup. (ignore-errors (delete-process proc))) + (unwind-protect + (with-temp-buffer + (setq proc (start-file-process "test3" (current-buffer) "cat")) + (should (processp proc)) + (should (equal (process-status proc) 'run)) + (set-process-filter proc t) + (process-send-string proc "foo\n") + (process-send-eof proc) + ;; Read output. + (with-timeout (10 (tramp--test-timeout-handler)) + (while (process-live-p proc) + (while (accept-process-output proc 0 nil t)))) + ;; No output due to process filter. + (should (= (point-min) (point-max)))) + + ;; Cleanup. + (ignore-errors (delete-process proc))) + ;; Process connection type. (when (and (tramp--test-sh-p) (not (tramp-direct-async-process-p)) @@ -4735,6 +4753,28 @@ If UNSTABLE is non-nil, the test is tagged as `:unstable'." ;; Cleanup. (ignore-errors (delete-process proc))) + (unwind-protect + (with-temp-buffer + (setq proc + (with-no-warnings + (make-process + :name "test3" :buffer (current-buffer) :command '("cat") + :filter t + :file-handler t))) + (should (processp proc)) + (should (equal (process-status proc) 'run)) + (process-send-string proc "foo\n") + (process-send-eof proc) + ;; Read output. + (with-timeout (10 (tramp--test-timeout-handler)) + (while (process-live-p proc) + (while (accept-process-output proc 0 nil t)))) + ;; No output due to process filter. + (should (= (point-min) (point-max)))) + + ;; Cleanup. + (ignore-errors (delete-process proc))) + ;; Process sentinel. (unwind-protect (with-temp-buffer