Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: exit trap and list pipelines
- X-seq: zsh-workers 39898
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: exit trap and list pipelines
- Date: Wed, 9 Nov 2016 21:19:57 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=7MsB0XUdAY2SwFISe8yvNDwrHGGBlwF9VFgF4BJcnys=; b=DaIjYkTK2vw0K+0yyRz4FpWx82A9vf01ifsMVCr73F18KJxlx2rFGd2JQ/bhfLlSx6 s+DO72vkt2+CYm3IM5HEU2spHt8Qu2GH/lfQ0OlST6hRfImvfnqmq4I2TqmbrU8H9qP1 tYn9DKvIgSOL17TFdhVg/T6+zRK0Y+49ahev2GDTtorhAluLIWV4qB9nfocEyDofl4KF clr17AQ6mySx1Uhyt8wGJ5yt3cdgnzrZXr2vHujKcev3p0GWPRhWqJZzDP230Ovr14ku petQOGZJeyBK44M+GtsU5Ju/WxJmj8J4BuudY2H6VWhBOgVQRY1Yv7815gBjGREzq8ZJ Fsxw==
- In-reply-to: <1478745377.2440153.783050761.5D9FA45B@webmail.messagingengine.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>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1478745377.2440153.783050761.5D9FA45B@webmail.messagingengine.com>
On Nov 9, 9:36pm, Anthony Heading wrote:
}
} Printing '6' here seems wrong? I think it didn't some years back.
}
} % zsh -c 'trap "echo hello" EXIT; { :; } | wc -c'
} 6
} hello
zsh-2.6 and zsh-3.0 yeild 0, zsh-4.3.17 prints 6.
The change occured because, where zsh formerly would note that the
right side was an external command and "exec" it (thereby disabling
the exit trap), newer zsh notices that there is a trap and does
another fork so that the trap can execute after wc finishes. This
means that both sides of the pipe run the trap, whereas before
(and in bash) only one side does so.
However, in the older zsh case, there were circumstances in which
the trap did not execute *at all*.
commit 261193a5b7da4ba36ca146424b000aca27c69235
Author: Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri Mar 30 16:51:54 2001 +0000
Fix problem with traps not runing if shell exec'd final command
(workers/13851)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author