Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: non-interactive set -m
- X-seq: zsh-workers 27135
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: non-interactive set -m
- Date: Sun, 12 Jul 2009 16:01:56 +0100
- In-reply-to: <loom.20090711T230600-306@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <p.w.stephenson@xxxxxxxxxxxx> <200907111905.n6BJ54oS026712@xxxxxxxxxxxxxxxxxxx> <loom.20090711T230600-306@xxxxxxxxxxxxxx>
On Sat, 11 Jul 2009 23:16:51 +0000 (UTC)
Eric Blake <ebb9@xxxxxxx> wrote:
> I interpret this to mean that subshells of a parent process with job
> control on must also have job control on, but that their list of
> tracked processes is nuked.
These look fairly straightforward, if we don't run into problems later
on. They can be attached to POSIX_JOBS---that's why I gave it a generic
name originally.
This looks to me like quite a big change in the way background processes
from subshells work, but if it's what POSIX users expects that's
fine---I'm not expecting anyone to turn the option on just for fun.
Index: Doc/Zsh/options.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v
retrieving revision 1.83
diff -u -r1.83 options.yo
--- Doc/Zsh/options.yo 10 Jul 2009 11:08:48 -0000 1.83
+++ Doc/Zsh/options.yo 12 Jul 2009 14:59:11 -0000
@@ -1280,10 +1280,26 @@
pindex(NOPOSIXJOBS)
cindex(bg, output in POSIX format)
cindex(fg, output in POSIX format)
+cindex(job control, in subshell)
+cindex(jobs, output in subshell)
item(tt(POSIX_JOBS) <K> <S>)(
-When putting jobs in the background or foreground with tt(bg) or tt(fg),
-just print the text of the job as required by POSIX,
-rather than the full information that would be output by tt(jobs).
+This option makes job control more compliant with the POSIX standard.
+
+When the option is not set, the tt(MONITOR) option is unset on entry to
+subshells, so that job control is no longer active. When the option is
+set, the tt(MONITOR) option and job control remain active in the
+subshell, but note that the subshell has no access to jobs in the parent
+shell.
+
+When the option is not set, jobs put in the background or foreground
+with tt(bg) or tt(fg) are displayed with the same information that would
+be reported by tt(jobs). When the option is set, only the text is
+printed. The output from tt(jobs) itself is not affected by the option.
+
+When the option is not set, job information from the parent
+shell is saved for output within a subshell (for example, within a
+pipeline). When the option is set, the output of tt(jobs) is empty
+unless job control has been activated within the subshell.
)
enditem()
Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.169
diff -u -r1.169 exec.c
--- Src/exec.c 11 Jul 2009 19:06:52 -0000 1.169
+++ Src/exec.c 12 Jul 2009 14:59:12 -0000
@@ -944,7 +950,9 @@
}
if (!(sigtrapped[SIGQUIT] & ZSIG_IGNORED))
signal_default(SIGQUIT);
- opts[MONITOR] = opts[USEZLE] = 0;
+ if (!isset(POSIXJOBS))
+ opts[MONITOR] = 0;
+ opts[USEZLE] = 0;
zleactive = 0;
if (flags & ESUB_PGRP)
clearjobtab(monitor);
Index: Src/jobs.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v
retrieving revision 1.70
diff -u -r1.70 jobs.c
--- Src/jobs.c 11 Jul 2009 19:06:52 -0000 1.70
+++ Src/jobs.c 12 Jul 2009 14:59:12 -0000
@@ -1292,6 +1292,8 @@
{
int i;
+ if (isset(POSIXJOBS))
+ oldmaxjob = 0;
for (i = 1; i <= maxjob; i++) {
/*
* See if there is a jobtable worth saving.
@@ -1299,7 +1301,7 @@
* once for each subshell of a shell with job control,
* so doesn't create a leak.
*/
- if (monitor && jobtab[i].stat)
+ if (monitor && !isset(POSIXJOBS) && jobtab[i].stat)
oldmaxjob = i+1;
else if (jobtab[i].stat & STAT_INUSE)
freejob(jobtab + i, 0);
--
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author