Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: What's a superjob?
- X-seq: zsh-workers 43567
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Subject: Re: What's a superjob?
- Date: Wed, 26 Sep 2018 10:42:00 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=duzQ592DsPmv3JvLZONgTOJ1W7n3uGaGWdKxatqGr9U=; b=wJY50SoCDS3riPdr88FQzBe6nGLk44aQUt7F/PNeDbJ2c43SduwaaDXO1Uv1fr84JJ S4+ucc7KNdxHTAvc2jYKBqBIsi+o8y97RTrbZ0tBfstuMRjBMp2WQctOY7sr9uFrJv57 KWnvSDCOu99TdWTrZSRXKfS+5yBfq9wadn+4HhrFNBoacmYNu10zVYA972wFQ1Vn3ZQH omNGEtaL1JyCP+7Mzv7/wtVpocN4BtNJ9IOrzY0YpyP240MWWxz1bmHWHT8cx8Uad5qE JFUoqh5TU9ZLmfgB716ZkxD38kg+db8GC/iiLEHw7k+FlSuHcEI8vXwD/9EfFDugvzwd DCFg==
- In-reply-to: <20180926155055eucas1p2a9eeba9267adcb603fbd609e47780010~X-fvU7i_h1255912559eucas1p2q@eucas1p2.samsung.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CGME20180926153149epcas3p1a817e8295570aa23ef107f7ecb95f980@epcas3p1.samsung.com> <1537975883.2212216.1521491576.1CF7021B@webmail.messagingengine.com> <20180926155055eucas1p2a9eeba9267adcb603fbd609e47780010~X-fvU7i_h1255912559eucas1p2q@eucas1p2.samsung.com>
On Wed, Sep 26, 2018 at 8:51 AM Peter Stephenson
<p.stephenson@xxxxxxxxxxx> wrote:
>
> Now we have just one process running: the main shell, and vi. Suppose
> you hit ^Z. Then vi suspends. The main shell is in the middle of
> running e, but it's not supposed to finish doing that till vi exits.
> But without special action we're now back at the top-level shell prompt
> and it never will execute.
To add a bit more color here ... in the absence of this special
handling, when vi is suspended, the shell has two choices:
1) treat vi as successfully completed and continue executing the function, or
2) treat vi as failed and stop the function at this point.
IIRC different shells have historically made different decisions about
this. I believe zsh's original behavior was #1, but that led to
problems if (in this type of example) the remainder of the function
depends on the content of the edited file. So #2 avoids side-effects,
but causes at minimum annoyance because now you have a suspended vi
but the rest of the function is simply gone.
The other possibility is to immediately fork the whole function as
soon as any non-builtin command is encountered, and then have the
forked function fork again for the external job, to keep the process
tree "normal". This would simplify the job handling in the main
shell, but ruin the intention of the function being able to affect the
main shell context in the case where no job control ever occurs.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author