1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 18:40:39 -08:00

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.
This commit is contained in:
Michael Albinus 2020-05-07 10:27:14 +02:00
parent 3b5f728bff
commit de5f59219a
3 changed files with 10 additions and 0 deletions

View 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))

View 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))

View 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))