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

Jobs unexpectedly disowned



I'm seeing weird behavior with jobs getting disowned and I'm not sure
whether it's intended.

Code:

    function f1() { sleep 1 & }
    function f2() { sleep 1 &; true }

    function g1() { f1; jobs; wait }
    function g2() { f2; jobs; wait }

    echo g1; g1
    echo g2; g2

When ran from `zsh -df` I get this:

    g1
    [2] 31060
    [2]  + running    sleep 1
    [2]  + done       sleep 1

    g2
    [2] 31061

I expected the output from g2 to look the same as from g1 but it's
different. Somehow the background job gets disowned when f2 returns.
However, this doesn't happen if I call f2 directly instead of going
through g2.

    f2; jobs; wait
    [2] 31137
    [2]  + running    sleep 1
    [2]  + done       sleep 1

Is this behavior intended?

Roman.



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