]> git.eshelyaron.com Git - emacs.git/commitdiff
Handle signals in Tramp's process-file
authorMichael Albinus <michael.albinus@gmx.de>
Thu, 7 May 2020 08:27:14 +0000 (10:27 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Thu, 7 May 2020 08:27:14 +0000 (10:27 +0200)
* lisp/net/tramp-adb.el (tramp-adb-handle-process-file):
* lisp/net/tramp-sh.el (tramp-sh-handle-process-file): Handle signals.

* test/lisp/net/tramp-tests.el (tramp-test28-process-file): Adapt test.

lisp/net/tramp-adb.el
lisp/net/tramp-sh.el
test/lisp/net/tramp-tests.el

index 7f829f15205d2f3fd02015b9af7932bb63550b72..7ef07afb8ef1ed1c3248e284272bbf06244e3e08 100644 (file)
@@ -918,6 +918,10 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
         (kill-buffer (tramp-get-connection-buffer v))
         (setq ret 1)))
 
+      ;; Handle signals.
+      (when (and (natnump ret) (> ret 128))
+       (setq ret (format "Signal %d" (- ret 128))))
+
       ;; Provide error file.
       (when tmpstderr (rename-file tmpstderr (cadr destination) t))
 
index c6eb7a8ff492aa3e91e4d69cabbb952af27a0251..c609f58cdd89615ea7b6f90813ee7ce2dd85dbc3 100644 (file)
@@ -3159,6 +3159,10 @@ STDERR can also be a file name."
         (kill-buffer (tramp-get-connection-buffer v))
         (setq ret 1)))
 
+      ;; Handle signals.
+      (when (and (natnump ret) (> ret 128))
+       (setq ret (format "Signal %d" (- ret 128))))
+
       ;; Provide error file.
       (when tmpstderr (rename-file tmpstderr (cadr destination) t))
 
index 462539a7c1778566320ef74c6d03187bce04ab90..4cacfa2f7129e7da743e3ad7837c1ae51b65fe3f 100644 (file)
@@ -4209,6 +4209,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
            (should-not (zerop (process-file "false")))
            (should-not (zerop (process-file "binary-does-not-exist")))
            (should (= 42 (process-file "sh" nil nil nil "-c" "exit 42")))
+           ;; Return string in case the process is interrupted.
+           (should (stringp (process-file "sh" nil nil nil "-c" "kill -2 $$")))
            (with-temp-buffer
              (write-region "foo" nil tmp-name)
              (should (file-exists-p tmp-name))