zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: jobs -r doesn't show jobs continued by kill -CONT
Date: Tue, 5 May 2015 12:02:14 -0700	[thread overview]
Message-ID: <150505120214.ZM18560@torch.brasslantern.com> (raw)
In-Reply-To: <20150504183647.687c0c1e@ntlworld.com>

On May 4,  6:36pm, Peter Stephenson wrote:
} Subject: Re: jobs -r doesn't show jobs continued by kill -CONT
}
} On Mon, 4 May 2015 06:52:13 +0800
} Han Pingtian <hanpt@linux.vnet.ibm.com> wrote:
} > jobs -r doesn't show a job which suspended the continued by kill -CONT:
} 
} Not sure whether to use makerunning() here.  It's handled per process
} rather than per job at this point, so it's not entirely clear at what
} point the STAT_STOPPED flag should be removed, either.

Is there compound-command weirdness that's going to show up as a result
of changing jn->stat along with pn->status if there is more than one
process per job?

torch% sleep 50 | sleep 51 | sleep 52

zsh: suspended  sleep 50 | sleep 51 | sleep 52
torch% ps ax | grep sleep
18552 pts/3    T      0:00 sleep 50
18553 pts/3    T      0:00 sleep 51
18554 pts/3    T      0:00 sleep 52
18556 pts/3    S+     0:00 grep sleep
torch% kill -CONT 18553
torch% jobs
[1]  + suspended  sleep 50 | 
       running    sleep 51 | 
       suspended  sleep 52
torch% jobs -s
torch% jobs -r
[1]  + suspended  sleep 50 | 
       running    sleep 51 | 
       suspended  sleep 52
torch% 

Is it really correct to treat that last one as "running" when two-thirds
of it is still stopped?

There's something else a bit odd here, but I don't know that it's fixable.

torch% sleeper() { echo sleeping; sleep 50; echo done sleeping }
torch% sleeper
torch% sleeper                                                  
sleeping
zsh: suspended  sleeper
torch% jobs -l
[1]  + 18524 suspended  sleeper
torch% kill -CONT 18524
done sleeping                                                                   
torch% ps x | grep sleep
18523 pts/3    T      0:00 sleep 50

So the function resumed but its child remained stopped.  On the other
hand if I CONT the child sleep itself, the function remains "suspended"
as far as the parent "jobs" can tell, but it wakes up and exits when it
gets the CHLD from the actual sleep timing out.

torch% sleeper
sleeping
zsh: suspended  sleeper
torch% jobs -l
[1]  + 18543 suspended  sleeper
torch% kill -CONT 18542
torch% ps ax | grep '1854[23]'
18542 pts/3    S      0:00 sleep 50
18543 pts/3    T      0:00 Src/zsh -f
torch% done sleeping

[1]  + done       sleeper
torch% 


-- 
Barton E. Schaefer


  reply	other threads:[~2015-05-05 19:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-03 22:52 Han Pingtian
2015-05-04  6:26 ` Bart Schaefer
2015-05-04 17:36 ` Peter Stephenson
2015-05-05 19:02   ` Bart Schaefer [this message]
2015-05-05 19:14     ` 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=150505120214.ZM18560@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).