Function: hypb:call-process-p

hypb:call-process-p is a byte-compiled function defined in hypb.el.

Signature

(hypb:call-process-p PROGRAM &optional INFILE PREDICATE &rest ARGS)

Documentation

Call an external PROGRAM with INFILE for input.

If PREDICATE is given, it is evaluated in a buffer with the PROGRAM's output and the result returned. If PREDICATE is nil, returns t iff program has no output or just a 0-valued output. Rest of ARGS are passed as arguments to PROGRAM.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hypb.el
(defun hypb:call-process-p (program &optional infile predicate &rest args)
  "Call an external PROGRAM with INFILE for input.
If PREDICATE is given, it is evaluated in a buffer with the PROGRAM's
output and the result returned.  If PREDICATE is nil, returns t iff
program has no output or just a 0-valued output.
Rest of ARGS are passed as arguments to PROGRAM."
  (let ((buf (get-buffer-create "*test-output*"))
	(found))
    (with-current-buffer buf
      (setq buffer-read-only nil)
      (erase-buffer)
      (apply 'call-process program infile buf nil args)
      (setq found
	    (if predicate
		(eval predicate)
	      (or (= (point-max) 1) ;; No output, consider cmd a success.
		  (and (< (point-max) 4)
		       (string= (buffer-substring 1 2) "0")))))
      (set-buffer-modified-p nil)
      (kill-buffer buf))
    found))