emacs-diffs
[Top][All Lists]
Advanced

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

emacs-28 9ff6999: Accept process-filter t in Tramp


From: Michael Albinus
Subject: emacs-28 9ff6999: Accept process-filter t in Tramp
Date: Thu, 14 Oct 2021 08:32:56 -0400 (EDT)

branch: emacs-28
commit 9ff6999a060244c7726752f5cb07e8c8d1218f41
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    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.
---
 lisp/net/tramp-adb.el        |  2 +-
 lisp/net/tramp-sh.el         |  2 +-
 lisp/net/tramp.el            |  2 +-
 test/lisp/net/tramp-tests.el | 40 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 63ffb2d..6d8bed1 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 8fa53cb..6984dd8 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 a8ae71b..318b4e4 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 ebedbaf..da15401 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



reply via email to

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