Commit 7fda3941 authored by Michael Albinus's avatar Michael Albinus

Fix `tramp-interrupt-process'

* lisp/net/tramp.el (tramp-interrupt-process): Improve command.

* test/lisp/net/tramp-tests.el (tramp-test06-directory-file-name)
(tramp-test26-file-name-completion): Simplify.
(tramp-test31-interrupt-process): Remove :unstable tag.
parent de1d150a
......@@ -5006,10 +5006,12 @@ name of a process or buffer, or nil to default to the current buffer."
(tramp-error proc 'error "Process %s is not active" proc)
(tramp-message proc 5 "Interrupt process %s with pid %s" proc pid)
;; This is for tramp-sh.el. Other backends do not support this (yet).
;; Not all "kill" implementations support process groups by
;; negative pid, so we try both variants.
(process-get proc 'vector)
(format "kill -2 -%d" pid))
(format "(\\kill -2 -%d || \\kill -2 %d) 2>/dev/null" pid pid))
;; Wait, until the process has disappeared. If it doesn't,
;; fall back to the default implementation.
(while (tramp-accept-process-output proc 0))
......@@ -5064,10 +5066,5 @@ name of a process or buffer, or nil to default to the current buffer."
;; and friends, for most of the handlers this is the major
;; difference between the different backends. Other handlers but
;; *-process-file would profit from this as well.
;; * Get rid of `shell-command'. In its primary implementation, it
;; uses `process-file-shell-command' and
;; `start-file-process-shell-command', which is sufficient due to
;; connection-local `shell-file-name'.
;;; tramp.el ends here
......@@ -2217,11 +2217,10 @@ This checks also `file-name-as-directory', `file-name-directory',
;; Bug#10085.
(when (tramp--test-enabled) ;; Packages like tramp-gvfs.el might be disabled.
(dolist (n-e '(nil t))
(dolist (non-essential '(nil t))
;; We must clear `tramp-default-method'. On hydra, it is "ftp",
;; which ruins the tests.
(let ((non-essential n-e)
(let ((tramp-default-method
(file-remote-p tramp-test-temporary-file-directory 'method))
(host (file-remote-p tramp-test-temporary-file-directory 'host)))
......@@ -4035,10 +4034,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
;; Cleanup.
(tramp-change-syntax orig-syntax))))
(dolist (n-e '(nil t))
(dolist (non-essential '(nil t))
(dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
(let ((non-essential n-e)
(tmp-name (tramp--test-make-temp-name nil quoted)))
(let ((tmp-name (tramp--test-make-temp-name nil quoted)))
......@@ -4419,9 +4417,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
(ert-deftest tramp-test31-interrupt-process ()
"Check `interrupt-process'."
;; The test fails from time to time, w/o a reproducible pattern. So
;; we mark it as unstable.
:tags '(:expensive-test :unstable)
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
(skip-unless (tramp--test-sh-p))
;; Since Emacs 26.1.
......@@ -4435,7 +4431,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
kill-buffer-query-functions proc)
(setq proc (start-file-process "test" (current-buffer) "sleep" "10"))
(setq proc (start-file-process-shell-command
"test" (current-buffer)
"trap 'echo boom; exit 1' 2; sleep 100"))
(should (processp proc))
(should (process-live-p proc))
(should (equal (process-status proc) 'run))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment