From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 8931024D32 for ; Fri, 19 Apr 2024 21:01:48 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1713553308; b=G5Vjl8zYwRiuZ7DNYrw6NEdM7jQKBXOQCbSeU0V1BmvyYVXyDwAxkVmeZDmOBJaDxACfhP8IOd VGEYDm5A0UQv7B3xw+vkEukPEKaCcD+Nkf69oIoQt54aeQ2A50lCMthjJFm820NhefjMTZSd8o eLjc5xeti63Jr+PJdUili8qt6gWmLuRKgDa69FeXyqJnOEyt9xGFWnNOXTf1+qaa8Xe83LXHpA JU6kIzUz8uC7rLFbaeU5A0tA24khbFUC5WC2tuvGPF1qIyxy1l1EUJM9JKh2GF+ePqamLJaSvZ SUvRoklWFXBVWMnOM0eTXbi5CGl3DfAvt+5od/is/oet9A==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (joooj.vinc17.net) smtp.remote-ip=155.133.131.76; dmarc=none header.from=vinc17.net; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1713553308; bh=6nO8TXE3qByrfqMtqNE67aATSZW7UU05eI0t8qF/Fgs=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:To:From:Date:DKIM-Signature; b=VKiCYx/1tz+YPQT86s/BC3JyfcjSumwkUh6bbMii99uvg5fqUwpRqS6S0zo4us5dYSBdGzjwq9 267uXE0UGejgE1MPaunOC7d0HYQ9fJIkzyGfbCK/AekmlvxZIs+QJIpYCcyfGfnf6DACp1fKaA xlglMcJ1yK2M+RyirWg5PtDcTJO5yVQgPVRcq/Vz+HjZ4Vn8u31M7cbi7PDXgxFsM1H5PET41i ZGE0WCRFARg93QMl/8at4qkk5fp1rvDSMnaaJyUEtq07svEG1nVl/veztXhw+YRTLr+ezD6Fzv PQVT92mjF0NEKwm7bgpjb9TqcxcMuLa0888bRQY7RF4gvQ==; 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:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=cGRJZzTS/JtEFMzefsLtYIMu4HSXzGWVjaB4aX/wEu4=; b=CexHdcE3hBLrHWBordj9zSU0DY Gxe6sR4OKVQ58hUovHOWLyOzKaN6c2AQ425HpVCiFw6t1yL/fDkOhhiJJBJeCB9C/aLii2Iie5STq t/36MpHBwKKPUVzPHFrujNL+rg9yNkutBA1Po0FwePAnmFUXEZIm+m7ZJpYU84ITp8CieA3QYikar MiqFbWZJ4qFL10wM2Z46ijR2yK74ODCSY3T8x+CGIWxxWIXPCQhlN233v2/kxeG7ZF05VX3FQ69Dn jPYmtOzlIcl5eqRhcpgRaaT4UW9H7+jWydVBzzuuafPCVak/1zDiJJ39x3O5czNKKIOtJfPsGrIJi +m2am/wA==; Received: by zero.zsh.org with local id 1rxtUZ-000E1Y-U7; Fri, 19 Apr 2024 19:01:47 +0000 Authentication-Results: zsh.org; iprev=pass (joooj.vinc17.net) smtp.remote-ip=155.133.131.76; dmarc=none header.from=vinc17.net; arc=none Received: from joooj.vinc17.net ([155.133.131.76]:54818) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1rxtTI-000DAA-Am; Fri, 19 Apr 2024 19:00:29 +0000 Received: by joooj.vinc17.net (Postfix, from userid 1000) id 3CF97F37; Fri, 19 Apr 2024 21:00:27 +0200 (CEST) Date: Fri, 19 Apr 2024 21:00:27 +0200 From: Vincent Lefevre To: zsh-users@zsh.org Subject: Re: How to propagate SIGTERM to the foreground job, if any? Message-ID: <20240419190027.GA109916@joooj.vinc17.net> Mail-Followup-To: zsh-users@zsh.org References: <20240419171752.GA48158@cventin.lip.ens-lyon.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/2.2.12+69 (354c5b11) vl-149028 (2023-12-10) X-Seq: 29836 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On 2024-04-19 11:30:35 -0700, Bart Schaefer wrote: > On Fri, Apr 19, 2024 at 10:18 AM Vincent Lefevre wrote: > > How to propagate SIGTERM to the foreground job, if any? > > Hm ... if there's a foreground job, it should be the process group > leader for the terminal (so as to receive TSTP and INT), so it might > work just to do "kill 0 TERM" I don't understand why you are saying that "it should be the process group leader for the terminal". This is not true in my case (the leader is some ancestor), and note that I do not want to kill the whole process group. > > setopt TRAPS_ASYNC > > trap "trap - TERM; kill ${jobstates:+%%} $$" TERM > > > > But it seems that $jobstates is not available in the trap. > > It's not that $jobstates is not available, it's that the foreground > job isn't in the table at all. But then, why does "kill %%" work? Is there a way to know whether %% exists? -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)