;; Use an asynchronous process. By this, password can
;; be handled. We don't set a timeout, because the
- ;; copying of large files can last longer than 60
- ;; secs.
- (let ((p (apply 'start-process-shell-command
- (tramp-get-connection-name v)
- (tramp-get-connection-buffer v)
- copy-program
- (append
- copy-args
- (list "&&" "echo" "tramp_exit_status" "0"
- "||" "echo" "tramp_exit_status" "1")))))
- (tramp-message
- orig-vec 6 "%s"
- (mapconcat 'identity (process-command p) " "))
+ ;; copying of large files can last longer than 60 secs.
+ (let* ((command
+ (mapconcat
+ 'identity (append (list copy-program) copy-args)
+ " "))
+ (p (let ((default-directory
+ (tramp-compat-temporary-file-directory)))
+ (start-process-shell-command
+ (tramp-get-connection-name v)
+ (tramp-get-connection-buffer v)
+ command))))
+ (tramp-message orig-vec 6 "%s" command)
(tramp-set-connection-property p "vector" orig-vec)
(set-process-query-on-exit-flag p nil)
;; sending the password.
(let ((tramp-local-end-of-line tramp-rsh-end-of-line))
(tramp-process-actions
- p v nil tramp-actions-copy-out-of-band))
-
- ;; Check the return code.
- (goto-char (point-max))
- (unless
- (re-search-backward "tramp_exit_status [0-9]+" nil t)
- (tramp-error
- orig-vec 'file-error
- "Couldn't find exit status of `%s'"
- (mapconcat 'identity (process-command p) " ")))
- (skip-chars-forward "^ ")
- (unless (zerop (read (current-buffer)))
- (forward-line -1)
- (tramp-error
- orig-vec 'file-error
- "Error copying: `%s'"
- (buffer-substring (point-min) (point-at-eol))))))
+ p v nil tramp-actions-copy-out-of-band))))
;; Reset the transfer process properties.
(tramp-set-connection-property v "process-name" nil)
`(lambda (beg end)
(,coding beg end)
(let ((coding-system-for-write 'binary)
- (coding-system-for-read 'binary)
- (default-directory
- (tramp-compat-temporary-file-directory)))
+ (coding-system-for-read 'binary))
(apply
'tramp-call-process-region ,vec (point-min) (point-max)
(car (split-string ,compress)) t t nil
(cdr (split-string ,compress)))))
`(lambda (beg end)
(let ((coding-system-for-write 'binary)
- (coding-system-for-read 'binary)
- (default-directory
- (tramp-compat-temporary-file-directory)))
+ (coding-system-for-read 'binary))
(apply
'tramp-call-process-region ,vec beg end
(car (split-string ,compress)) t t nil
(tramp-message vec 3 "Process has finished.")
(throw 'tramp-action 'ok))
(tramp-message vec 3 "Process has died.")
- (throw 'tramp-action 'process-died))))
+ (throw 'tramp-action 'out-of-band-failed))))
(t nil)))
;;; Functions for processing the actions:
(tramp-get-connection-buffer vec) vec 'file-error
(cond
((eq exit 'permission-denied) "Permission denied")
+ ((eq exit 'out-of-band-failed)
+ (format-message
+ "Copy failed, see buffer `%s' for details"
+ (tramp-get-connection-buffer vec)))
((eq exit 'process-died)
(substitute-command-keys
(concat
It always returns a return code. The Lisp error raised when
PROGRAM is nil is trapped also, returning 1. Furthermore, traces
are written with verbosity of 6."
- (let ((v (or vec
+ (let ((default-directory (tramp-compat-temporary-file-directory))
+ (v (or vec
(vector tramp-current-method tramp-current-user
tramp-current-host nil nil)))
(destination (if (eq destination t) (current-buffer) destination))
It always returns a return code. The Lisp error raised when
PROGRAM is nil is trapped also, returning 1. Furthermore, traces
are written with verbosity of 6."
- (let ((v (or vec
+ (let ((default-directory (tramp-compat-temporary-file-directory))
+ (v (or vec
(vector tramp-current-method tramp-current-user
tramp-current-host nil nil)))
(buffer (if (eq buffer t) (current-buffer) buffer))