Function: tramp-process-running-p

tramp-process-running-p is a byte-compiled function defined in tramp.el.gz.

Signature

(tramp-process-running-p PROCESS-NAME)

Documentation

Return t if system process PROCESS-NAME is running for user-login-name(var)/user-login-name(fun).

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
(defun tramp-process-running-p (process-name)
  "Return t if system process PROCESS-NAME is running for `user-login-name'."
  (when (stringp process-name)
    (catch 'result
      (let ((default-directory temporary-file-directory))
	(dolist (pid (list-system-processes))
	  (and-let* ((attributes (process-attributes pid))
		     (comm (cdr (assoc 'comm attributes)))
		     ((string-equal
		       (cdr (assoc 'user attributes)) (user-login-name)))
		     ;; The returned command name could be truncated
		     ;; to 15 characters.  Therefore, we cannot check
		     ;; for `string-equal'.
		     ((eq t (compare-strings comm 0 15 process-name 0 15)))
		     ((throw 'result t)))))))))