emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/subr.el,v


From: Glenn Morris
Subject: [Emacs-diffs] Changes to emacs/lisp/subr.el,v
Date: Sat, 17 Nov 2007 03:42:22 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       07/11/17 03:42:22

Index: subr.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/subr.el,v
retrieving revision 1.568
retrieving revision 1.569
diff -u -b -r1.568 -r1.569
--- subr.el     16 Nov 2007 11:10:53 -0000      1.568
+++ subr.el     17 Nov 2007 03:42:22 -0000      1.569
@@ -1539,6 +1539,23 @@
 
 ;;;; Process stuff.
 
+(defun process-lines (program &rest args)
+  "Execute PROGRAM with ARGS, returning its output as a list of lines.
+Signal an error if the program returns with a non-zero exit status."
+  (with-temp-buffer
+    (let ((status (apply 'call-process program nil (current-buffer) nil args)))
+      (unless (eq status 0)
+       (error "%s exited with status %s" program status))
+      (goto-char (point-min))
+      (let (lines)
+       (while (not (eobp))
+         (setq lines (cons (buffer-substring-no-properties
+                            (line-beginning-position)
+                            (line-end-position))
+                           lines))
+         (forward-line 1))
+       (nreverse lines)))))
+
 ;; open-network-stream is a wrapper around make-network-process.
 
 (when (featurep 'make-network-process)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]