]> git.eshelyaron.com Git - emacs.git/commitdiff
* net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band):
authorMichael Albinus <michael.albinus@gmx.de>
Wed, 5 Dec 2012 14:06:06 +0000 (15:06 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Wed, 5 Dec 2012 14:06:06 +0000 (15:06 +0100)
Check return code of copy command.

lisp/ChangeLog
lisp/net/tramp-sh.el

index 42cd1dca3087c5d0aaafc479d21e0aae6ad02cd2..cbc0e743183e3cb47912ad2f35db7cd8dea11a1f 100644 (file)
@@ -1,5 +1,8 @@
 2012-12-05  Michael Albinus  <michael.albinus@gmx.de>
 
+       * net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band):
+       Check return code of copy command.
+
        * net/tramp-adb.el (tramp-adb-sdk-dir, tramp-adb-prompt): Use
        group `tramp'.  Add version.
 
index 340b7ad353debf3f482e30899cfcbe9861dacae2..28a06b2a64748fc701a9ac1dfaf64c95220b79a0 100644 (file)
@@ -2379,17 +2379,41 @@ The method used must be an out-of-band method."
                ;; last longer than 60 secs.
                (let ((p (let ((default-directory
                                 (tramp-compat-temporary-file-directory)))
-                          (apply 'start-process
+                          (apply 'start-process-shell-command
                                  (tramp-get-connection-name v)
                                  (tramp-get-connection-buffer v)
                                  copy-program
-                                 (append copy-args (list source target))))))
+                                 (append
+                                  copy-args
+                                  (list
+                                   (shell-quote-argument source)
+                                   (shell-quote-argument target))
+                                  (unless (memq system-type '(windows-nt))
+                                    '(";" "echo"
+                                      "tramp_exit_status" "$?")))))))
                  (tramp-message
                   orig-vec 6 "%s"
                   (mapconcat 'identity (process-command p) " "))
                  (tramp-compat-set-process-query-on-exit-flag p nil)
                  (tramp-process-actions
-                  p v nil tramp-actions-copy-out-of-band)))
+                  p v nil tramp-actions-copy-out-of-band)
+
+                 ;; Check the return code.  This does not work under
+                 ;; MS Windows.
+                 (unless (memq system-type '(windows-nt))
+                   (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'" (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)))))))
 
            ;; Reset the transfer process properties.
            (tramp-message orig-vec 6 "\n%s" (buffer-string))