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

Re: Anonymous functions don't show up well in "jobs" builtin output, except



> On 24/10/2022 22:49 John Hawkinson <jhawk@xxxxxxxxxxxx> wrote: I
> recently had a use-case where I needed to use an anonymous function
> shell one-liner to do some trickery with =() process substitution
> persisting for multiple commands (That is, () { thing1 $1; thing2 $1 }
> =(echo echo foo) ). I was surprised to find the resulting command was
> not meaningfully represented in the jobs builtin output.
>
> lrr% () { cat; }
> ^Z
> zsh: suspended

This is probably related to another continuing thread --- it's likely to
be because the anonymous function was originally running in the current
shell, and the entire shell was forked to continue running it in the
background.  This doesn't have the same job text a normal process would
have --- both a straight "cat" and "( cat )" are running as separate
processes from the start.

It's probably possible to do better but quite how hard it's going to be
dragging the job text round the houses I'm not sure.

pws




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