diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/net/tramp-adb.el | 8 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 8 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 17 | ||||
| -rw-r--r-- | lisp/simple.el | 14 |
4 files changed, 41 insertions, 6 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 7ef07afb8ef..b4a080ee0f6 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el | |||
| @@ -918,9 +918,11 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." | |||
| 918 | (kill-buffer (tramp-get-connection-buffer v)) | 918 | (kill-buffer (tramp-get-connection-buffer v)) |
| 919 | (setq ret 1))) | 919 | (setq ret 1))) |
| 920 | 920 | ||
| 921 | ;; Handle signals. | 921 | ;; Handle signals. `process-file-return-signal-string' exists |
| 922 | (when (and (natnump ret) (> ret 128)) | 922 | ;; since Emacs 28.1. |
| 923 | (setq ret (format "Signal %d" (- ret 128)))) | 923 | (when (and (bound-and-true-p process-file-return-signal-string) |
| 924 | (natnump ret) (> ret 128)) | ||
| 925 | (setq ret (nth (- ret 128) (tramp-get-signal-strings)))) | ||
| 924 | 926 | ||
| 925 | ;; Provide error file. | 927 | ;; Provide error file. |
| 926 | (when tmpstderr (rename-file tmpstderr (cadr destination) t)) | 928 | (when tmpstderr (rename-file tmpstderr (cadr destination) t)) |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index c609f58cdd8..523663cafbd 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -3159,9 +3159,11 @@ STDERR can also be a file name." | |||
| 3159 | (kill-buffer (tramp-get-connection-buffer v)) | 3159 | (kill-buffer (tramp-get-connection-buffer v)) |
| 3160 | (setq ret 1))) | 3160 | (setq ret 1))) |
| 3161 | 3161 | ||
| 3162 | ;; Handle signals. | 3162 | ;; Handle signals. `process-file-return-signal-string' exists |
| 3163 | (when (and (natnump ret) (> ret 128)) | 3163 | ;; since Emacs 28.1. |
| 3164 | (setq ret (format "Signal %d" (- ret 128)))) | 3164 | (when (and (bound-and-true-p process-file-return-signal-string) |
| 3165 | (natnump ret) (>= ret 128)) | ||
| 3166 | (setq ret (nth (- ret 128) (tramp-get-signal-strings)))) | ||
| 3165 | 3167 | ||
| 3166 | ;; Provide error file. | 3168 | ;; Provide error file. |
| 3167 | (when tmpstderr (rename-file tmpstderr (cadr destination) t)) | 3169 | (when tmpstderr (rename-file tmpstderr (cadr destination) t)) |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 70fb46bb4cb..ee263ebe933 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -5047,6 +5047,23 @@ name of a process or buffer, or nil to default to the current buffer." | |||
| 5047 | (lambda () | 5047 | (lambda () |
| 5048 | (remove-hook 'interrupt-process-functions #'tramp-interrupt-process)))) | 5048 | (remove-hook 'interrupt-process-functions #'tramp-interrupt-process)))) |
| 5049 | 5049 | ||
| 5050 | (defun tramp-get-signal-strings () | ||
| 5051 | "Strings to return by `process-file' in case of signals." | ||
| 5052 | ;; We use key nil for local connection properties. | ||
| 5053 | (with-tramp-connection-property nil "signal-strings" | ||
| 5054 | (let (result) | ||
| 5055 | (if (and (stringp shell-file-name) (executable-find shell-file-name)) | ||
| 5056 | (dotimes (i 128) | ||
| 5057 | (push | ||
| 5058 | (if (= i 19) 1 ;; SIGSTOP | ||
| 5059 | (call-process | ||
| 5060 | shell-file-name nil nil nil "-c" (format "kill -%d $$" i))) | ||
| 5061 | result)) | ||
| 5062 | (dotimes (i 128) | ||
| 5063 | (push (format "Signal %d" i) result))) | ||
| 5064 | ;; Due to Bug#41287, we cannot add this to the `dotimes' clause. | ||
| 5065 | (reverse result)))) | ||
| 5066 | |||
| 5050 | ;; Checklist for `tramp-unload-hook' | 5067 | ;; Checklist for `tramp-unload-hook' |
| 5051 | ;; - Unload all `tramp-*' packages | 5068 | ;; - Unload all `tramp-*' packages |
| 5052 | ;; - Reset `file-name-handler-alist' | 5069 | ;; - Reset `file-name-handler-alist' |
diff --git a/lisp/simple.el b/lisp/simple.el index b5ba05426f5..d151d6c9aeb 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -4141,6 +4141,20 @@ its behavior with respect to remote file attribute caching. | |||
| 4141 | You should only ever change this variable with a let-binding; | 4141 | You should only ever change this variable with a let-binding; |
| 4142 | never with `setq'.") | 4142 | never with `setq'.") |
| 4143 | 4143 | ||
| 4144 | (defcustom process-file-return-signal-string nil | ||
| 4145 | "Whether to return a string describing the signal interrupting a process. | ||
| 4146 | When a process returns an exit code greater than 128, it is | ||
| 4147 | interpreted as a signal. `process-file' requires to return a | ||
| 4148 | string describing this signal. | ||
| 4149 | Since there are processes violating this rule, returning exit | ||
| 4150 | codes greater than 128 which are not bound to a signal, | ||
| 4151 | `process-file' returns the exit code as natural number also in | ||
| 4152 | this case. Setting this user option to non-nil forces | ||
| 4153 | `process-file' to interpret such exit codes as signals, and to | ||
| 4154 | return a corresponding string." | ||
| 4155 | :version "28.1" | ||
| 4156 | :type 'boolean) | ||
| 4157 | |||
| 4144 | (defun start-file-process (name buffer program &rest program-args) | 4158 | (defun start-file-process (name buffer program &rest program-args) |
| 4145 | "Start a program in a subprocess. Return the process object for it. | 4159 | "Start a program in a subprocess. Return the process object for it. |
| 4146 | 4160 | ||