Function: hypb:return-process-output

hypb:return-process-output is a byte-compiled function defined in hypb.el.

Signature

(hypb:return-process-output PROGRAM &optional INFILE &rest ARGS)

Documentation

Return as a string the output from external PROGRAM with INFILE for input.

Rest of ARGS are passed as arguments to PROGRAM. Removes any trailing newline at the end of the output.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hypb.el
(defun hypb:return-process-output (program &optional infile &rest args)
  "Return as a string the output from external PROGRAM with INFILE for input.
Rest of ARGS are passed as arguments to PROGRAM.
Removes any trailing newline at the end of the output."
  (let ((buf (get-buffer-create "*test-output*"))
	(output))
    (with-current-buffer buf
      (setq buffer-read-only nil)
      (erase-buffer)
      (apply 'call-process program infile buf nil args)
      (setq output (buffer-string))
      ;; Remove trailing newline from output.
      (when (> (length output) 0)
        (setq output (substring output 0 -1)))
      (set-buffer-modified-p nil)
      (kill-buffer buf))
    output))