[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: guile pipeline do-over
From: |
Ludovic Courtès |
Subject: |
Re: guile pipeline do-over |
Date: |
Thu, 26 Mar 2020 10:09:53 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Hi Rutger,
(+Cc: Andy.)
Rutger van Beusekom <address@hidden> skribis:
> From d351c0a5ecde62e63368bec0e1f15108495a1a71 Mon Sep 17 00:00:00 2001
> From: Rutger van Beusekom <address@hidden>
> Date: Mon, 2 Mar 2020 10:38:57 +0100
> Subject: [PATCH] Add pipeline procedure.
>
> * libguile/posix.c (scm_open_process): Remove.
> (scm_piped_process): Add to replace open_process.
> * module/ice-9/popen.scm (pipe->fdes): Add to convert pipe pair to fdes pair.
> (open-process): Add open-process for backwards compatibility.
> (pipeline): Add to implement a pipeline using piped-process.
There are a couple super minor issues that I comment on below, but
otherwise LGTM! If Andy agrees, we can apply it once the copyright
assignment is on file, so maybe it won’t be in 3.0.2, we’ll see!
> +@deffn (Scheme Procedure) pipeline commands
^ ^
Should be braces.
> +Execute a @code{pipeline} of @var{commands} -- where each command is a
> +list of a program and its arguments as strings -- returning an input
s/--/---/ so we get an em dash and not an en dash (I’m a typography
nitpicker :-)).
> +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}.
> +
> +@example
> +(let ((commands '(("git" "ls-files")
> + ("tar" "-cf-" "-T-")
> + ("sha1sum" "-")))
^
There’s an extra space on these lines
> + (pipe-fail? (compose not
> + zero?
> + status:exit-val
> + cdr
> + waitpid)))
I don’t think we should encourage this style, which could also look
obscure to newcomers. I’d just make it a regular lambda.
That’s all for me.
Thanks again, Rutger!
Ludo’.