zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: Jobs unexpectedly disowned
Date: Thu, 01 Aug 2019 22:00:24 +0100	[thread overview]
Message-ID: <70bf670bc77bbf78f36671ab09cc2a020499c8f5.camel@ntlworld.com> (raw)
In-Reply-To: <1564583126.6561.15.camel@samsung.com>

On Wed, 2019-07-31 at 14:25 +0000, Peter Stephenson wrote:
> 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.

This might be good enough --- a job that's been backgrounded has
been told not to use the terminal and if it's semi-detached in
that fashion we probably want it to show up as job.

pws

diff --git a/Src/exec.c b/Src/exec.c
index 2acb2c0bc..e81053d67 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1690,7 +1690,8 @@ execpline(Estate state, wordcode slcode, int how, int last1)
 
 	    lastwj = thisjob = newjob;
 
-	    if (list_pipe || (pline_level && !(how & Z_TIMED)))
+	    if (list_pipe || (pline_level && !(how & Z_TIMED) &&
+			      !(jn->stat & STAT_NOSTTY)))
 		jn->stat |= STAT_NOPRINT;
 
 	    if (nowait) {


      reply	other threads:[~2019-08-01 21:01 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
2019-07-21  6:20   ` Roman Perepelitsa
2019-07-31 14:25   ` Peter Stephenson
2019-08-01 21:00     ` Peter Stephenson [this message]

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=70bf670bc77bbf78f36671ab09cc2a020499c8f5.camel@ntlworld.com \
    --to=p.w.stephenson@ntlworld.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).