From b32ac17c32486d8fce0fb9ecd5e09fe324448d3d Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sun, 3 Feb 2019 11:07:36 +0100 Subject: Work on accept-process-output in Tramp * lisp/net/tramp.el (tramp-accept-process-output): Rework timer handling. (tramp-call-process): Adapt VEC if nil. (tramp-interrupt-process): Use `tramp-accept-process-output'. (tramp-process-lines): New defun. * lisp/net/tramp-adb.el (tramp-adb-parse-device-names): * lisp/net/tramp-rclone.el (tramp-rclone-parse-device-names): Use it. * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch): Use timeout 0 in `tramp-accept-process-output'. * test/lisp/net/tramp-tests.el (tramp--test-timeout-handler): Move up. (tramp-test29-start-file-process, tramp-test30-make-process) (tramp-test32-shell-command) (tramp--test-shell-command-to-string-asynchronously): Use it. (tramp-test35-remote-path): Suppress warning. (tramp--test-asynchronous-requests-timeout): New defconst. (tramp-test43-asynchronous-requests): Skip if not the only test. Use `tramp--test-asynchronous-requests-timeout'. Remove instrumentation. Use `start-process-shell-command' for watchdog. Add timeout in timer function. Print status messages. Remove file operations from sentinel. Suppress timers in `accept-process-output'. --- lisp/net/tramp-rclone.el | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) (limited to 'lisp/net/tramp-rclone.el') diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el index 77ff6d59a59..9f46adb4da6 100644 --- a/lisp/net/tramp-rclone.el +++ b/lisp/net/tramp-rclone.el @@ -171,24 +171,12 @@ pass to the OPERATION." (defun tramp-rclone-parse-device-names (_ignore) "Return a list of (nil host) tuples allowed to access." (with-tramp-connection-property nil "rclone-device-names" - (with-timeout (10) - (with-temp-buffer - ;; `call-process' does not react on timer under MS Windows. - ;; That's why we use `start-process'. - (let ((p (start-process - tramp-rclone-program (current-buffer) - tramp-rclone-program "listremotes")) - (v (make-tramp-file-name :method tramp-rclone-method)) - result) - (tramp-message v 6 "%s" (mapconcat 'identity (process-command p) " ")) - (process-put p 'adjust-window-size-function 'ignore) - (set-process-query-on-exit-flag p nil) - (while (accept-process-output p nil nil t)) - (tramp-message v 6 "\n%s" (buffer-string)) - (goto-char (point-min)) - (while (search-forward-regexp "^\\(\\S-+\\):$" nil t) - (push (list nil (match-string 1)) result)) - result))))) + (delq nil + (mapcar + (lambda (line) + (when (string-match "^\\(\\S-+\\):$" line) + `(nil ,(match-string 1 line)))) + (tramp-process-lines nil tramp-rclone-program "listremotes"))))) ;; File name primitives. -- cgit v1.2.1