Skip to content

Commit

Permalink
Accept process-filter t in Tramp
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
albinus committed Oct 14, 2021
1 parent cf95962 commit 9ff6999
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lisp/net/tramp-adb.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
2 changes: 1 addition & 1 deletion lisp/net/tramp-sh.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
2 changes: 1 addition & 1 deletion lisp/net/tramp.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
40 changes: 40 additions & 0 deletions test/lisp/net/tramp-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9ff6999

Please sign in to comment.