diff --git a/doc/ref/posix.texi b/doc/ref/posix.texi index e5d63c7b3..b2be9d707 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"