From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 20340 invoked from network); 25 Oct 2021 23:28:49 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 25 Oct 2021 23:28:49 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1635204529; b=q+uBu7jY2E7zLh9Ua5ABfa0dtWhHoPodu1KoAiIdpN0dXoYxgyaN2VxVukEtLx0ZQY2/1xkUuS SK8pO7KJCgyjTZJKAGQfYldZKb1H1nR5Jb5LFu2Xl4oM+xHeGEqbAA2nbrchWY4S+/G3qBzPUV DYWKnpNIBbm/TRmpPu87nLrTzm5KVw6LF8eq87qX2Gt3TKBt70jgPElrUwvC3TYSRrBDgId1dl YIJhyrGPlL3o8g7fnKndqIB3YkximaU+Hkulw7BUScR38XlNV+VcpcPc79tk/1Tw+RQ9HWp1z3 uKV6z9/N+FN2rQQxRCbWAxZjajMjF3hceHYJrR/PL0Z+EQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (shout02.mail.de) smtp.remote-ip=62.201.172.25; dkim=pass header.d=mail.de header.s=mailde202009 header.a=rsa-sha256; dmarc=pass header.from=mail.de; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1635204529; bh=XRCdkiDq054p94vJKiNqJi1xZD89H6UDNSMzvnOUKXM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:MIME-Version:Date: Message-ID:Subject:From:To:DKIM-Signature:DKIM-Signature; b=GPYk6i6FJR1fg9gyASPm4zq+JZ3cyb0o5WTGZzxiAGkJsUYN2XQGdzYiORutsQ4FNn58dxC6Jr NjBHZI6ZonZTkpzoxSQT9hHxA8O2NE6k51yZpUtwXVhbk0Ab1FmVtKY3WuHwwzj6bCDWlYNkv7 bimskxTqishyylS56VJInG5gUpCjyqREl/O0gL6FKdhSiG+XTvc2ySSTIedwYozdCi+ApDqYJn WLVlQ10V5toVtoNA3c68oH/UDoxLw58x09/4WqS2jLnILHhGbbu2viCik6nHs34eSWV7dwLI/K i3rq6xIS9j4LzPSiT8qvKilc8V87Vd8tmZTMJ07uIHyGsg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Date:Message-ID:Subject:From:To:Reply-To:Cc: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=jVXTdT/oRiMQi6iXK380/wGylAHXD1V3HYd6VxVPNOs=; b=E5N3WYyOkQ/ibVg3aSYvASDP+j IzDlDnp0iO5OCIkkwnzxp2nTEMyIGmCUs+61Ogtlnnr9Bgufs8oiWsi/jjGrUApdg/YYg5wwUvaMC bb38GR1av+e+vrX8Iivfk04XdqfxLoSZtn7umDE1DghOGuxtpAjacyhxFEtC62N+X4htbxrM/c4W5 hS3jvLGiUOP3D5kJajxWjIwmEK8kgkU7Tw0totHBe7UXNhktLveLbTsjnRUA8+z9uFviChGD//Lvn CTr2q659ILCJ326llJ6gA2rgjYrBAWLTVah14RuYHa+dFWqOnacNI+JmgdmSuKPp6ReM+GE2Iw4uq 1lw9Z49Q==; Received: from authenticated user by zero.zsh.org with local id 1mf9OZ-0008ab-DN; Mon, 25 Oct 2021 23:28:47 +0000 Authentication-Results: zsh.org; iprev=pass (shout02.mail.de) smtp.remote-ip=62.201.172.25; dkim=pass header.d=mail.de header.s=mailde202009 header.a=rsa-sha256; dmarc=pass header.from=mail.de; arc=none Received: from shout02.mail.de ([62.201.172.25]:52857) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mf9O3-0008DA-6T; Mon, 25 Oct 2021 23:28:15 +0000 Received: from postfix01.mail.de (postfix02.bt.mail.de [10.0.121.126]) by shout02.mail.de (Postfix) with ESMTP id AD417A1D55 for ; Tue, 26 Oct 2021 01:28:14 +0200 (CEST) Received: from smtp04.mail.de (smtp04.bt.mail.de [10.0.121.214]) by postfix01.mail.de (Postfix) with ESMTP id 9477AA03C1 for ; Tue, 26 Oct 2021 01:28:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mail.de; s=mailde202009; t=1635204494; bh=XRCdkiDq054p94vJKiNqJi1xZD89H6UDNSMzvnOUKXM=; h=To:From:Subject:Date:From; b=jAywUBD4fWyoARjLDp17MkVWt41HgmtpvTesm5lLuL3h3JEHTDyc32WsxgYbdw+Ki slZIXZZh6SWR+TmSbdyX/bXuSxeBMdY+boE+kLnW6OaKjyR2MLPZd2q+IRyXtu4pN0 UtFou3Djo55QQPwNnXJcGlhaZCWTKXC7O2I2FC6FPWiSiRLOhHbcMmF00qC6/dS4NP VtrwKj3Cigfe4mPorWlGT3H1BMv3tezQonEmK7s+fUd1TGGeqfETnWMcHSLS0btmbn aq+tf346THeQxbaeJlfqpdUzwdrfuX1rNVjMPbkfvDwO1Xe3d9kRz2iXR1IqhX4ga/ jY+zA1cbMzVxw== Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtp04.mail.de (Postfix) with ESMTPSA id 554A1C009B for ; Tue, 26 Oct 2021 01:28:12 +0200 (CEST) To: Zsh hackers list From: Tycho Kirchner Subject: exit_function - strange behavior Message-ID: <8ce6fada-c1da-c64f-9eb2-ccce5250474a@mail.de> Date: Tue, 26 Oct 2021 01:28:12 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 1207 X-purgate-ID: 154282::1635204494-00004912-2F0DF8D9/0/0 X-Seq: 49526 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Dear zsh-maintainers, first of all, I'm not a mail-subscriber but please respond to this email anyway ^_^ In the function doc for zshexit it states: > Executed at the point where the main shell is about to exit normally. This is not called by exiting subshells... Having read that the following session yields a surprising result (at least for me): debian-dell% echo $ZSH_VERSION # Running on Debian Buster 5.8.0.2-dev debian-dell% __zshrc_exit(){ echo "__zshrc_exit in subshell $ZSH_SUBSHELL with $?"; } debian-dell% zshexit_functions+=(__zshrc_exit) debian-dell% ( echo foo ) foo debian-dell% ( exit 123 ) __zshrc_exit in subshell 1 with 123 # <--- debian-dell% On the other hand the exit function seems to be not called for the main shell, when a subshell called 'exit' immediately before: debian-dell% zsh -f -c '__zshrc_exit(){ echo "__zshrc_exit in subshell $ZSH_SUBSHELL with $?"; }; zshexit_functions+=(__zshrc_exit); (exit 123);' __zshrc_exit in subshell 1 with 123 debian-dell% In case that this is desired behavior, how would one execute custom code *only* on exit of the main-shell? Thanks in advance Kind regards Tycho Kirchner