guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 03/03: doc: Tweak 'pipeline' documentation.


From: Ludovic Courtès
Subject: [Guile-commits] 03/03: doc: Tweak 'pipeline' documentation.
Date: Sat, 16 May 2020 16:36:39 -0400 (EDT)

civodul pushed a commit to branch master
in repository guile.

commit 0e912cee24235ca5df31d7495d44b36dd571da86
Author: Ludovic Courtès <address@hidden>
AuthorDate: Sat May 16 22:35:33 2020 +0200

    doc: Tweak 'pipeline' documentation.
    
    * doc/ref/posix.texi (Pipes): Adjust markup.  Simplify example.
---
 doc/ref/posix.texi | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/doc/ref/posix.texi b/doc/ref/posix.texi
index e5d63c7..b2be9d7 100644
--- a/doc/ref/posix.texi
+++ b/doc/ref/posix.texi
@@ -2370,10 +2370,9 @@ processes, and a system-wide limit on the number of 
pipes, so pipes
 should be closed explicitly when no longer needed, rather than letting
 the garbage collector pick them up at some later time.
 
-@findex pipeline
-@deffn {Scheme Procedure} pipeline commands
-Execute a @code{pipeline} of @var{commands} --- where each command is a
-list of a program and its arguments as strings --- returning an input
+@deffn {Scheme Procedure} pipeline @var{commands}
+Execute a pipeline of @var{commands}, where each command is a
+list of a program and its arguments as strings, returning an input
 port to the end of the pipeline, an output port to the beginning of the
 pipeline and a list of PIDs of the processes executing the @var{commands}.
 
@@ -2381,18 +2380,16 @@ pipeline and a list of PIDs of the processes executing 
the @var{commands}.
 (let ((commands '(("git" "ls-files")
                   ("tar" "-cf-" "-T-")
                   ("sha1sum" "-")))
-      (pipe-fail? (lambda (pid)
-                    (not
-                     (zero?
-                      (status:exit-val
-                       (cdr
-                        (waitpid pid))))))))
+      (success? (lambda (pid)
+                  (zero?
+                   (status:exit-val (cdr (waitpid pid)))))))
   (receive (from to pids) (pipeline commands)
     (let* ((sha1 (read-delimited " " from))
-           (index (list-index pipe-fail? (reverse pids))))
+           (index (list-index (negate success?) (reverse pids))))
       (close to)
       (close from)
-      (if (not index) sha1
+      (if (not index)
+          sha1
           (string-append "pipeline failed in command: "
                          (string-join (list-ref commands index)))))))
 @result{} "52f99d234503fca8c84ef94b1005a3a28d8b3bc1"



reply via email to

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