children of Emacs. @xref{System Processes}.
@end deffn
+Sometimes, it is necessary to send a signal to a non-local
+asynchronous process. This is possible by writing an own
+@code{interrupt-process} implementation. This function must be added
+then to @code{interrupt-process-functions}.
+
+@defvar interrupt-process-functions
+This variable is a list of functions to be called for
+@code{interrupt-process}. The arguments of the functions are the same
+as for @code{interrupt-process}. These functions are called in the
+order of the list, until one of them returns non-@code{nil}. The
+default function, which shall always be the last in this list, is
+@code{internal-default-interrupt-process}.
+
+This is the mechanism, how Tramp implements @code{interrupt-process}.
+@end defvar
+
@node Output from Processes
@section Receiving Output from Processes
@cindex process output
probability of data corruption due to techniques Emacs uses to recover
in these situations.
++++
+** 'interrupt-process' consults now the list
+'interrupt-process-functions', which function has to be called in
+order to deliver the SIGINT signal. This allows Tramp to send the
+SIGINT signal to remote asynchronous processes. The hitherto existing
+implementation has been moved to 'internal-default-interrupt-process'.
+
+++
** File local and directory local variables are now initialized each
time the major mode is set, not just when the file is first visited.
'tramp-remote-process-environment' enables reading of shell
initialization files.
+---
+*** Tramp is able now to send SIGINT to remote asynchronous processes.
+
---
*** Variable 'tramp-completion-mode' is obsoleted.
(t process)))
pid)
;; If it's a Tramp process, send the INT signal remotely.
- (when (and (processp proc)
+ (when (and (processp proc) (process-live-p proc)
(setq pid (process-get proc 'remote-pid)))
(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).
Vprocess_adaptive_read_buffering = Qt;
DEFVAR_LISP ("interrupt-process-functions", Vinterrupt_process_functions,
- doc: /* List of functions to be called for `interrupt-function'.
-The arguments of the functions are the same as for `interrupt-function'.
+ doc: /* List of functions to be called for `interrupt-process'.
+The arguments of the functions are the same as for `interrupt-process'.
These functions are called in the order of the list, until one of them
returns non-`nil'. */);
Vinterrupt_process_functions = list1 (Qinternal_default_interrupt_process);
(with-temp-buffer
(setq proc (start-file-process "test" (current-buffer) "sleep" "10"))
(should (processp proc))
+ (should (process-live-p proc))
(should (equal (process-status proc) 'run))
- (interrupt-process proc)
- (should (equal (process-status proc) 'signal)))
+ (should (interrupt-process proc))
+ ;; Let the process accept the interrupt.
+ (accept-process-output proc 1 nil 0)
+ (should-not (process-live-p proc))
+ (should (equal (process-status proc) 'signal))
+ ;; An interrupted process cannot be interrupted, again.
+ ;; Does not work reliable.
+ ;; (should-error (interrupt-process proc)))
+ )
;; Cleanup.
(ignore-errors (delete-process proc)))))