emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master de5f592: Handle signals in Tramp's process-file


From: Michael Albinus
Subject: master de5f592: Handle signals in Tramp's process-file
Date: Thu, 7 May 2020 04:27:25 -0400 (EDT)

branch: master
commit de5f59219ac02c6502907f6a24538ddabf487839
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Handle signals in Tramp's process-file
    
    * 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        | 4 ++++
 lisp/net/tramp-sh.el         | 4 ++++
 test/lisp/net/tramp-tests.el | 2 ++
 3 files changed, 10 insertions(+)

diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 7f829f1..7ef07af 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -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))
 
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index c6eb7a8..c609f58 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -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))
 
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 462539a..4cacfa2 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]