Function: dired-check-process

dired-check-process is a byte-compiled function defined in dired-aux.el.gz.

Signature

(dired-check-process MSG PROGRAM &rest ARGUMENTS)

Documentation

Display MSG, then run PROGRAM, and log any error messages from it.

ARGUMENTS should be strings to be passed to PROGRAM as command-line arguments.

If PROGRAM exits successfully, display "MSG...done" and return nil. If PROGRAM exits abnormally, save in dired-log-buffer the command that invoked PROGRAM and the messages it emitted, and return either the offending ARGUMENTS or PROGRAM if no ARGUMENTS were provided.

Source Code

;; Defined in /usr/src/emacs/lisp/dired-aux.el.gz
(defun dired-check-process (msg program &rest arguments)
  "Display MSG, then run PROGRAM, and log any error messages from it.
ARGUMENTS should be strings to be passed to PROGRAM as command-line
arguments.

If PROGRAM exits successfully, display \"MSG...done\" and return nil.
If PROGRAM exits abnormally, save in `dired-log-buffer' the command
that invoked PROGRAM and the messages it emitted, and return either
the offending ARGUMENTS or PROGRAM if no ARGUMENTS were provided."
  (let ((dir default-directory)
        (reporter (make-progress-reporter msg))
        err-buffer err)
    (save-excursion
      ;; Get a clean buffer for error output:
      (setq err-buffer (get-buffer-create " *dired-check-process output*"))
      (set-buffer err-buffer)
      (erase-buffer)
      (setq default-directory dir	; caller's default-directory
	    err (not (eq 0 (apply #'process-file program nil t nil arguments))))
      (dired-uncache dir)
      (if err
	  (progn
	    (dired-log (concat program " " (prin1-to-string arguments) "\n"))
	    (dired-log err-buffer)
	    (or arguments program t))
	(kill-buffer err-buffer)
        (progress-reporter-done reporter)
        nil))))