[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 7fda394 1/2: Fix `tramp-interrupt-process'
From: |
Michael Albinus |
Subject: |
master 7fda394 1/2: Fix `tramp-interrupt-process' |
Date: |
Thu, 13 Feb 2020 10:34:53 -0500 (EST) |
branch: master
commit 7fda39419296cda9ae1c01c8ca69a30775db68b0
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>
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.
---
lisp/net/tramp.el | 9 +++------
test/lisp/net/tramp-tests.el | 18 ++++++++----------
2 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 6928df4..409e1f7 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -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.
(tramp-compat-funcall
'tramp-send-command
(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
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index f70f324..3e19289 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -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)
- (tramp-default-method
+ (let ((tramp-default-method
(file-remote-p tramp-test-temporary-file-directory 'method))
(host (file-remote-p tramp-test-temporary-file-directory 'host)))
(dolist
@@ -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)))
(unwind-protect
(progn
@@ -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)
(unwind-protect
(with-temp-buffer
- (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))