zsh-workers
 help / color / mirror / code / Atom feed
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Jobs unexpectedly disowned
Date: Sun, 21 Jul 2019 08:19:26 +0200	[thread overview]
Message-ID: <CAN=4vMp4pMM1JHKVYz9Wzr1N8qhwZ4auXGThFTkA-BFWHgvOyg@mail.gmail.com> (raw)

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.

             reply	other threads:[~2019-07-21  6:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20190721062030epcas2p2326b1b0c1779aba66272cc90656e2a29@epcas2p2.samsung.com>
2019-07-21  6:19 ` Roman Perepelitsa [this message]
2019-07-21  6:20   ` Roman Perepelitsa
2019-07-31 14:25   ` Peter Stephenson
2019-08-01 21:00     ` Peter Stephenson

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='CAN=4vMp4pMM1JHKVYz9Wzr1N8qhwZ4auXGThFTkA-BFWHgvOyg@mail.gmail.com' \
    --to=roman.perepelitsa@gmail.com \
    --cc=zsh-workers@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).