From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 4dd57dd2 for ; Wed, 18 Dec 2019 04:55:37 +0000 (UTC) Received: (qmail 26805 invoked by alias); 18 Dec 2019 04:55:32 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45077 Received: (qmail 9548 invoked by uid 1010); 18 Dec 2019 04:55:32 -0000 X-Qmail-Scanner-Diagnostics: from mail-lj1-f176.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25663. spamassassin: 3.4.2. Clear:RC:0(209.85.208.176):SA:0(-1.9/5.0):. Processed in 2.402378 secs); 18 Dec 2019 04:55:32 -0000 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.208.176 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=R3V+PXU5ZTpXG+GXD8oo4LvLDAYGoM7Nzwo51dAqdmE=; b=QJ6a6Gj5SeXMSuGPOU1+dB3kyr3Q521m+IQ/Fz+JbH37qz9t7nanTXo5yjSb0TNeko NIRh6YxVhA1ZUUtHTOU8RIq/IXERlf72v8NvLN6z6iGtZeYQNQcjE0ZLv4zGKXtdtv84 y/C7m0BHwaUPOaDNRmprs0nQZeiZpKMfDuDtIcw5OhEJM1iquZs9/Nf+Bh67jy/P7kdj SOye0x4p2RsvAmu3/CwMgCMhfT4gjCd02yY0OgvZ2eTnK62641143fZrqjbkb6SEtS+V QGfklAH2nDdUkqME9eAt2g4zJfBbK4vJk8uuUDTYGxX0SMQj6/out86walRKZ2+MoIu5 ECtw== X-Gm-Message-State: APjAAAXVBz4yl72zCFK3pQ/lQFDVUMIDgK8qyt/8vD9rKZh7nitOco+y xmy+TE9BD/fD25QhTkmg3jsDF/SgKoXH79QTOuXcH5IPCy8= X-Google-Smtp-Source: APXvYqyjKGlFqYc7ZXPRaxJdVQX3Fzx7xC4RVvyIxin7j/pnoOx+YyKtuBuVuLnfcbwqDzi9Oz5xvVkZY4fTk5YEUSY= X-Received: by 2002:a2e:9592:: with SMTP id w18mr219062ljh.98.1576644895629; Tue, 17 Dec 2019 20:54:55 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Tue, 17 Dec 2019 20:54:44 -0800 Message-ID: Subject: Re: { exit } always { foo } To: Daniel Shahaf Cc: "zsh-workers@zsh.org" Content-Type: text/plain; charset="UTF-8" On Tue, Dec 17, 2019 at 7:57 PM Daniel Shahaf wrote: > > Which is correct, the manual or the test? I think both are, although the wording in the doc might be clearer. This is the important bit (my capitals): > An tt(exit) command (or a tt(return) command executed AT THE OUTERMOST > function LEVEL of a script) encountered in tt(try-list) does em(not) cause > the execution of var(always-list). Instead, the shell exits immediately > after any tt(EXIT) trap has been executed. The word "function" there is unfortunate because it doesn't mean a shell function. In this line: > 725 mytest() { { exit 3 } always { mywrap }; print Exited before this } The always block is NOT at the outermost level, so the shell does not exit immediately. "Outermost" means that there IS NO surrounding function scope. Thus in the following case: ( mywrap() { echo BEGIN; true; echo END } { exit 3 } always { mywrap }; print Exited before this ) The always block is not executed and mywrap isn't called. As soon as you put the "always" inside the "mytest" scope, that rule no longer applies.