zsh-users
 help / color / mirror / code / Atom feed
From: Zach Riggle <zachriggle@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Efficient way to map a list of values to multiple processes, then accumulate their output
Date: Sat, 6 Nov 2021 16:58:42 -0500	[thread overview]
Message-ID: <CAMP9c5=GjmYCbvwUOoj8HM6M2DFDOtf3m2_BpF2pqN+Fv6CWUw@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7Ymg=D1cjb2NRVUPXoNPzXxaNm=q1m-0P4dX_+yWUjPhw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1218 bytes --]

Wow.  I'm genuinely impressed, it even supports all of the flags that I
need!  And has all of the fun non-determinism of parallel execution (with
-P)!  This satisfies about 60% of what I need, and is a great tool to have
handy!

The limitation appears to be that the command is run in a sub-shell /
separate process (as one might expect), so there's no way to correlate
input74 → output74.

I suppose with "zargs -n1" I can redirect the output of each to an
individual file (in an e.g. temporary file), and then just read them back
and stick everything into an associative array.

A very simple test works exactly correct, but a slight variation gives me
"zargs: argument list too long":

Uploaded the source here for ease of viewing and syntax highlighting:
https://gist.github.com/zachriggle/b53b35faa5a60b674575e1dc6cae1d2e

*Zach Riggle*


On Sat, Nov 6, 2021 at 11:18 AM Bart Schaefer <schaefer@brasslantern.com>
wrote:

> On Sat, Nov 6, 2021 at 6:41 AM Zach Riggle <zachriggle@gmail.com> wrote:
> >
> > Ultimately, I'd like to have some quasi-implementation of xargs -P in
> pure zsh -- which maps a __function__ to a list of arguments
>
> Look at "zargs" in "man zshcontrib"
>

[-- Attachment #2: Type: text/html, Size: 1968 bytes --]

  reply	other threads:[~2021-11-06 21:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-06 13:40 Zach Riggle
2021-11-06 16:18 ` Bart Schaefer
2021-11-06 21:58   ` Zach Riggle [this message]
2021-11-06 22:55     ` Lawrence Velázquez
2021-11-08 20:27       ` Zach Riggle
2021-11-08 20:45         ` Zach Riggle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMP9c5=GjmYCbvwUOoj8HM6M2DFDOtf3m2_BpF2pqN+Fv6CWUw@mail.gmail.com' \
    --to=zachriggle@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).