zsh-users
 help / color / mirror / code / Atom feed
From: Eric Nielsen <ericbn@hey.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: "zsh-users@zsh.org" <zsh-users@zsh.org>
Subject: Re: Assign to outer parameter from function called by zargs
Date: Tue, 28 Mar 2023 15:34:23 -0500	[thread overview]
Message-ID: <80675331828b603f64380626d518dffd875e5587@hey.com> (raw)
In-Reply-To: <CAH+w=7ZuqAAc09kw5sQO1tg-mdC_HphXcYR-ii=aLo8nogFr7A@mail.gmail.com>

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

>> assign_outer runs in a subshell, so it cannot modify the parameters
of
>> the parent shell.

> More specifically, there's this comment in zargs:
>
> # Everything has to be in a subshell so that we don't "wait" for any
> # unrelated jobs of the parent shell.
>
> The "wait" is necessary to set the return status of zargs in (as
> nearly as possible) the same way that xargs would do, so you can't run
> current-shell actions with zargs.

Thanks Roman and Bart for the explanation. Makes perfect sense.

> What's the context of your question and your desired end result?

My use case might be too specific: I wanted to somehow capture the end
result of the processing of all the calls made by zargs. I didn't want
to rely on the zargs return code when zargs is used with -P as it was
missing values before Zsh 5.9 and it's intermittently failing in Zsh 5.9
and macOS. (https://www.zsh.org/mla/workers/2022/msg00611.html)
So I though having the called functions assign a status code in an outer
parameter could work. It was not a good idea...  :- )


--
Sent with HEY <https://hey.com/sent>

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

      reply	other threads:[~2023-03-28 20:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28 16:24 Eric Nielsen
2023-03-28 17:50 ` Roman Perepelitsa
2023-03-28 19:53   ` Bart Schaefer
2023-03-28 20:34     ` Eric Nielsen [this message]

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=80675331828b603f64380626d518dffd875e5587@hey.com \
    --to=ericbn@hey.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).