Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Functions that start Jobs
- X-seq: zsh-users 3978
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: gmargo@xxxxxxxxx
- Subject: Re: Functions that start Jobs
- Date: Fri, 29 Jun 2001 08:30:26 +0000
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <20010629010412.A1776@xxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20010628153316.B20290@xxxxxxxxx> <010628170738.ZM8419@xxxxxxxxxxxxxxxxxxxxxxx> <20010629010412.A1776@xxxxxxxxx>
On Jun 29, 1:04am, Gregory Margo wrote:
}
} Why does a function take up a job slot?
Because you can suspend it with ^Z, and at that point it does become a
separate job that appears in the "jobs" output.
E.g.
zagzig% foo() { sleep 30 & sleep 10 }
zagzig% foo
[2] 13882
<ctrl-Z>
zsh: suspended foo
zagzig% jobs
[1] + suspended foo
[2] - running sleep 30
} And if it does, why doesn't 'exec' work?
If you mean what I think you mean, then the reason is that 'exec' deals
with processes -- it makes a new process replace the old process. But
job table entries are not processes; they're just zsh's internal method
of doing record-keeping for commands in progress.
Loops take up a job table slot too:
zagzig% jobs
zagzig% repeat 2 do sleep 5 & done
[2] 13890
[3] 13891
Here "repeat ..." is job 1, so the backgrounded sleeps become 2 and 3.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author