zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@sunsite.dk
Subject: Re: Problems with background jobs in a script.
Date: Sun, 3 Aug 2008 12:27:08 +0100	[thread overview]
Message-ID: <20080803122708.3be66cdb@pws-pc> (raw)
In-Reply-To: <pdy98830624086ac4b89c662c83@[192.168.1.2]>

On Fri, 1 Aug 2008 05:18:16 -0700
Dave Yost <Dave@Yost.com> wrote:
> The script below exhibits several problems.
> 
> All I'm trying to do is to get a script to recursively kill all of 
> its background processes on exit. (In my case, this should be an 
> issue only when the script is killed.)

I'm actually suprised it gets as far as it does.  Essentially no thought
has been put into to job control for non-interactive shells (when the
MONITOR option is not set); it so happens zsh still uses its job table
for storing information about jobs it's started, but many of the fixes
to make things appear seamless (or at least more closely stitched) only
work with MONITOR.  That may be fixable to some extent (particularly
with background jobs where the task is already separate from the main
shell even without the normal job control OS support) but there's so
much to do to the shell I shouldn't hold your breath.

You could try pretending the script is interactive (with the -i option
--- I tried this it and certainly made a better stab at your script) but
that may have side effects.
 
Possibly it's simpler to keep track of the process numbers you need to
kill by recording them from $!.  However, since in this case the shell
doesn't guarantee to tell you when the process is terminated you can't
be absolutely sure you're killing the right process.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


      parent reply	other threads:[~2008-08-03 11:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-01 12:18 Dave Yost
2008-08-02 22:55 ` Bart Schaefer
2008-08-03 11:27 ` 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=20080803122708.3be66cdb@pws-pc \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@sunsite.dk \
    /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).