Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: non-interactive set -m



On Jul 12,  4:01pm, Peter Stephenson wrote:
}
} 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.

If zsh was previously in the wrong here, then so is pdksh:

schaefer[507] ksh                                                         4.2.0
$ sleep 30 &
[1] 14322
$ (jobs)
[1] + Running              sleep 30 
$ jobs | head
[1] + Running              sleep 30 
$ (wait)
$ (fg)
ksh: fg: job control not enabled
$ [1] + Done                 sleep 30 

Now, in pdksh "jobs | head" the "jobs" command is in the foreground
shell and "head" is forked off, whereas in zsh both "jobs" and "head"
will have been forked because of handling of this case ...

$ jobs | read line
$ echo $line

$ jobs | { read line; echo $line;}
[1] + Running sleep 30
$ 

... where in zsh the first "echo $line" will work (but won't any more
with this patch and POSIX_JOBS set).

POSIX doesn't specify whether the left or right side of a pipeline
will run in the current shell, which means that with POSIX_JOBS set
and this patch applied zsh will produce different results for the
piping of "jobs" to something.  Since it's only been about a year (?)
since we went through all the rigamarole of making "jobs" in a sub-
shell have access to (a snapshot of) the parent's job table, it seems
hasty to break that again even an as option.

Also look here:

$ sleep 30 &
[1] 14341
$ ( sleep 40 & jobs )
[2] + Running              sleep 40 
[1] - Running              sleep 30 
$ 

Note that in pdksh the job in the subshell is added to the table of
jobs inherited from the parent shell (testing with pdksh 5.2.14).

This may be something we should ask about on the austin-group list
before we select an interpretation and implement it.  I'm currently
not able to post there because of some problem with the listserv's
interpretation of the "+" in the email address I used to sign up.



Messages sorted by: Reverse Date, Date, Thread, Author