Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Assign to outer parameter from function called by zargs



>> 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


Messages sorted by: Reverse Date, Date, Thread, Author