Function: wallpaper--init-action-kill

wallpaper--init-action-kill is a byte-compiled function defined in wallpaper.el.gz.

Signature

(wallpaper--init-action-kill PROCESS-NAME)

Documentation

Return kill function for init-action of a wallpaper-setter structure.

The returned function kills any process named PROCESS-NAME owned by the current effective user id.

Source Code

;; Defined in /usr/src/emacs/lisp/image/wallpaper.el.gz
(defun wallpaper--init-action-kill (process-name)
  "Return kill function for `init-action' of a `wallpaper-setter' structure.
The returned function kills any process named PROCESS-NAME owned
by the current effective user id."
  (lambda ()
    (when-let ((procs
                (seq-filter (lambda (p) (let-alist p
                                     (and (= .euid (user-uid))
                                          (equal .comm process-name))))
                            (mapcar (lambda (pid)
                                      (cons (cons 'pid pid)
                                            (process-attributes pid)))
                                    (list-system-processes)))))
      (dolist (proc procs)
        (let-alist proc
          (when (y-or-n-p (format "Kill \"%s\" process with PID %d?" .comm .pid))
            (signal-process .pid 'TERM)))))))