diff options
| author | Michael Albinus | 2019-04-02 15:17:17 +0200 |
|---|---|---|
| committer | Michael Albinus | 2019-04-02 15:17:17 +0200 |
| commit | 3e8f9482fe2288baedd9cc5026e25ffc543683ab (patch) | |
| tree | 6a6bc145d8073c1eea79edf4b951b90783b6e2bf | |
| parent | 52e3d3d4c42c999d749d56958c03f1acc301df19 (diff) | |
| download | emacs-3e8f9482fe2288baedd9cc5026e25ffc543683ab.tar.gz emacs-3e8f9482fe2288baedd9cc5026e25ffc543683ab.zip | |
Suppress timers in tramp-send-string
* lisp/net/tramp.el (tramp-send-string): Suppress timers. Use
`with-local-quit'.
| -rw-r--r-- | lisp/net/tramp.el | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 5b50d39a0d4..7206d8eb8a6 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -3881,7 +3881,7 @@ of." | |||
| 3881 | (tramp-check-for-regexp proc tramp-password-prompt-regexp) | 3881 | (tramp-check-for-regexp proc tramp-password-prompt-regexp) |
| 3882 | (tramp-message vec 3 "Sending %s" (match-string 1)) | 3882 | (tramp-message vec 3 "Sending %s" (match-string 1)) |
| 3883 | ;; We don't call `tramp-send-string' in order to hide the | 3883 | ;; We don't call `tramp-send-string' in order to hide the |
| 3884 | ;; password from the debug buffer. | 3884 | ;; password from the debug buffer and the traces. |
| 3885 | (process-send-string | 3885 | (process-send-string |
| 3886 | proc (concat (tramp-read-passwd proc) tramp-local-end-of-line)) | 3886 | proc (concat (tramp-read-passwd proc) tramp-local-end-of-line)) |
| 3887 | ;; Hide password prompt. | 3887 | ;; Hide password prompt. |
| @@ -4171,12 +4171,20 @@ The STRING is expected to use Unix line-endings, but the lines sent to | |||
| 4171 | the remote host use line-endings as defined in the variable | 4171 | the remote host use line-endings as defined in the variable |
| 4172 | `tramp-rsh-end-of-line'. The communication buffer is erased before sending." | 4172 | `tramp-rsh-end-of-line'. The communication buffer is erased before sending." |
| 4173 | (let* ((p (tramp-get-connection-process vec)) | 4173 | (let* ((p (tramp-get-connection-process vec)) |
| 4174 | (chunksize (tramp-get-connection-property p "chunksize" nil))) | 4174 | (chunksize (tramp-get-connection-property p "chunksize" nil)) |
| 4175 | ;; We do not want to run timers. | ||
| 4176 | (tl timer-list) | ||
| 4177 | (stimers (with-timeout-suspend)) | ||
| 4178 | timer-list timer-idle-list) | ||
| 4175 | (unless p | 4179 | (unless p |
| 4176 | (tramp-error | 4180 | (tramp-error |
| 4177 | vec 'file-error "Can't send string to remote host -- not logged in")) | 4181 | vec 'file-error "Can't send string to remote host -- not logged in")) |
| 4178 | (tramp-set-connection-property p "last-cmd-time" (current-time)) | 4182 | (tramp-set-connection-property p "last-cmd-time" (current-time)) |
| 4179 | (tramp-message vec 10 "%s" string) | 4183 | (tramp-message vec 10 "%s" string) |
| 4184 | ;; Enable our progress reporter. | ||
| 4185 | (dolist (timer tl) | ||
| 4186 | (if (eq (timer--function timer) #'tramp-progress-reporter-update) | ||
| 4187 | (push timer timer-list))) | ||
| 4180 | (with-current-buffer (tramp-get-connection-buffer vec) | 4188 | (with-current-buffer (tramp-get-connection-buffer vec) |
| 4181 | ;; Clean up the buffer. We cannot call `erase-buffer' because | 4189 | ;; Clean up the buffer. We cannot call `erase-buffer' because |
| 4182 | ;; narrowing might be in effect. | 4190 | ;; narrowing might be in effect. |
| @@ -4189,17 +4197,20 @@ the remote host use line-endings as defined in the variable | |||
| 4189 | (string-equal (substring string -1) tramp-rsh-end-of-line)) | 4197 | (string-equal (substring string -1) tramp-rsh-end-of-line)) |
| 4190 | (setq string (concat string tramp-rsh-end-of-line))) | 4198 | (setq string (concat string tramp-rsh-end-of-line))) |
| 4191 | ;; Send the string. | 4199 | ;; Send the string. |
| 4192 | (if (and chunksize (not (zerop chunksize))) | 4200 | (with-local-quit |
| 4193 | (let ((pos 0) | 4201 | (if (and chunksize (not (zerop chunksize))) |
| 4194 | (end (length string))) | 4202 | (let ((pos 0) |
| 4195 | (while (< pos end) | 4203 | (end (length string))) |
| 4196 | (tramp-message | 4204 | (while (< pos end) |
| 4197 | vec 10 "Sending chunk from %s to %s" | 4205 | (tramp-message |
| 4198 | pos (min (+ pos chunksize) end)) | 4206 | vec 10 "Sending chunk from %s to %s" |
| 4199 | (process-send-string | 4207 | pos (min (+ pos chunksize) end)) |
| 4200 | p (substring string pos (min (+ pos chunksize) end))) | 4208 | (process-send-string |
| 4201 | (setq pos (+ pos chunksize)))) | 4209 | p (substring string pos (min (+ pos chunksize) end))) |
| 4202 | (process-send-string p string))))) | 4210 | (setq pos (+ pos chunksize)))) |
| 4211 | (process-send-string p string))) | ||
| 4212 | ;; Reenable the timers. | ||
| 4213 | (with-timeout-unsuspend stimers)))) | ||
| 4203 | 4214 | ||
| 4204 | (defun tramp-get-inode (vec) | 4215 | (defun tramp-get-inode (vec) |
| 4205 | "Returns the virtual inode number. | 4216 | "Returns the virtual inode number. |