aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/subr.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index c110390b44a..5a88fa4fd5d 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1539,6 +1539,23 @@ FILE should be the name of a library, with no directory name."
1539 1539
1540;;;; Process stuff. 1540;;;; Process stuff.
1541 1541
1542(defun process-lines (program &rest args)
1543 "Execute PROGRAM with ARGS, returning its output as a list of lines.
1544Signal an error if the program returns with a non-zero exit status."
1545 (with-temp-buffer
1546 (let ((status (apply 'call-process program nil (current-buffer) nil args)))
1547 (unless (eq status 0)
1548 (error "%s exited with status %s" program status))
1549 (goto-char (point-min))
1550 (let (lines)
1551 (while (not (eobp))
1552 (setq lines (cons (buffer-substring-no-properties
1553 (line-beginning-position)
1554 (line-end-position))
1555 lines))
1556 (forward-line 1))
1557 (nreverse lines)))))
1558
1542;; open-network-stream is a wrapper around make-network-process. 1559;; open-network-stream is a wrapper around make-network-process.
1543 1560
1544(when (featurep 'make-network-process) 1561(when (featurep 'make-network-process)