From 88c7dfa37000245fa2fdb6cf6fc6b425dd7c7ee3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20H=C3=B6tzel?= Date: Mon, 21 Jan 2013 10:40:51 +0100 Subject: [PATCH] * net/tramp-adb.el (tramp-adb-handle-start-file-process): Complete reimplementation using "adb shell command ..." instead of running remote shell interactively. --- lisp/ChangeLog | 6 ++++++ lisp/net/tramp-adb.el | 48 ++++++++++++++----------------------------- 2 files changed, 21 insertions(+), 33 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d439c661401..3700121e5fe 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-01-21 Jürgen Hötzel + + * net/tramp-adb.el (tramp-adb-handle-start-file-process): Complete + reimplementation using "adb shell command ..." instead of running + remote shell interactively. + 2013-01-20 Glenn Morris * emacs-lisp/lisp-mode.el (emacs-lisp-mode-map): diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index ab13d4cf442..6b8d16afc80 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -907,15 +907,11 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (cons program args) " ")))) (tramp-process-connection-type (or (null program) tramp-process-connection-type)) - (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) (name1 name) (i 0)) (unwind-protect (save-excursion (save-restriction - (unless buffer - ;; BUFFER can be nil. We use a temporary buffer. - (setq buffer (generate-new-buffer tramp-temp-buffer-name))) (while (get-process name1) ;; NAME must be unique as process name. (setq i (1+ i) @@ -923,35 +919,21 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." (setq name name1) ;; Set the new process properties. (tramp-set-connection-property v "process-name" name) - (tramp-set-connection-property v "process-buffer" buffer) - ;; Activate narrowing in order to save BUFFER contents. - ;; Clear also the modification time; otherwise we might - ;; be interrupted by `verify-visited-file-modtime'. - (with-current-buffer (tramp-get-connection-buffer v) - (let ((buffer-undo-list t)) - (clear-visited-file-modtime) - (narrow-to-region (point-max) (point-max)) - (if command - ;; Send the command. - (tramp-adb-send-command v command) - ;; Open the connection. - (tramp-adb-maybe-open-connection v)))) - (let ((p (tramp-get-connection-process v))) - ;; Set sentinel and query flag for this process. - (tramp-set-connection-property p "vector" v) - (set-process-sentinel p 'tramp-process-sentinel) - (tramp-compat-set-process-query-on-exit-flag p t) - ;; Return process. - p))) - ;; Save exit. - (with-current-buffer (tramp-get-connection-buffer v) - (if (string-match tramp-temp-buffer-name (buffer-name)) - (progn - (set-process-buffer (tramp-get-connection-process v) nil) - (kill-buffer (current-buffer))) - (set-buffer-modified-p bmp))) - (tramp-set-connection-property v "process-name" nil) - (tramp-set-connection-property v "process-buffer" nil))))) + (when command + (let* ((host (tramp-file-name-host v)) + (devices (mapcar 'cadr (tramp-adb-parse-device-names nil))) + (args (if (> (length host) 0) + (list "-s" host "shell" command) + (list "shell" command))) + (p (apply 'start-process (tramp-get-connection-name v) buffer + (tramp-adb-program) args))) + ;; Set sentinel and query flag for this process. + (tramp-set-connection-property p "vector" v) + (set-process-sentinel p 'tramp-process-sentinel) + (tramp-compat-set-process-query-on-exit-flag p t) + ;; Return process. + p)))) + (tramp-set-connection-property v "process-name" nil))))) ;; Helper functions. -- 2.39.2