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

Re: Jobs unexpectedly disowned



On Sun, 2019-07-21 at 08:19 +0200, Roman Perepelitsa wrote:
> I'm seeing weird behavior with jobs getting disowned and I'm not sure
> whether it's intended.
> 
>     function f2() { sleep 1 &; true }
>     function g2() { f2; jobs; wait }
> 
>     echo g2; g2
> 
> When ran from `zsh -df` I get this:
> 
>     g2
>     [2] 31061

We're not seeing job information because STAT_NOPRINT is being or'ed into the
job status by this code within execpline().

	    if (list_pipe || (pline_level && !(how & Z_TIMED)))
		jn->stat |= STAT_NOPRINT;

because pline_level is non-zero.  I think it's non-zero just because
we're inside the shell function at this point, but I don't understand
why that's supposed to make a difference, and I haven't understood how
this point in the code gets hold of the background job which (although I
haven't checked) should be one started with Z_ASYNC by a lower level
call to execpline().

I think pline_level is really there for stuff inside non-final bits of
pipelines, but this stuff is a bit obscure.  (No, really.)

I also haven't worked out what adding "true" has got to do with it, but
it does make the difference.

pws


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