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 D74DE242D9 for ; Fri, 19 Apr 2024 23:34:04 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1713562444; b=gl/bwBDOyA0ukAFy1c4BpP5sz4ab5ZdXi0LFtU/kweiFwQlLJtlcwZUhBmpZ4NvReSYjWBVZs3 YtCMiBYX4i+2SooYVlaUn8OnlzOwEGv8wF0nHdNB4WiD8J3Shy26NQXapEozdA9dVkE/k8AQd5 owKLyy40qdONWu/ToKdAlHZHEChLrSSh2Y93AL+AJnAIIBSu8Cc10uiepRPKfSeSW2+XJNRl7D bCSjJssLd0MDxu4tBlVEoUkwu4gfUzraLPT3mwDNSaEB4RkYENyI7uCg/lA81wieHw1JqhGokT 0KUW0oJ7AVCb0MltG8VEwvGE5BSJkVAU03dDDHjsyj+l3w==; 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=1713562444; bh=sVkMsYWYkvBSRb899jSLPgeiuObS8T+Sa3rKM0prRuQ=; 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=e5HH5Fxyoy8zyqIui3aLn0d6VmrIjn8vgTCkEmc5uZ/5XSnV+VkcZ0RJKyxF/0zjDhI0r2U1rz p0wdNju9f/8WhxXGaK0F7kSBVv7wpMDmZJa3YuoI3VHvAIRyAHC9A4twundqf2/liyhFZOsC9e r7OhAXtoy289ATdrQdaEEKNta2E9ciTBmlB/UEf3naJUWJUnYgIRDbedjEcwEcHeYyltnrlWXC ASqcgP/t3jnVm9sIewIJLiBQpjBqa+6ZCg1GPiPqcmPAU7whdc4wV1LsGu4yyD5cGBMIG6jU6E vPLgadjzmpGb8Nc+1Pb0Dh9jr9sqQPYR55QXdmNgvu5Osw==; 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=YD7MbDTTuTBq901DsqDWBMDRCJKeVEPw/ZH/LHjQZJQ=; b=jcL0COz7+0S9eU+OsGFdqcm6rv Cf7O1RScGCZxGKmTlxH4wDOrK1u0pW9h/KbcM7URBu4d0CFMUrAYx44amdED83Nv5VFVdj5SwZUV1 68pjPBb9T2e+z90SVF0gdQUTtSo0h1QVNzE7wX6hLzei5/w5FBN8RplbxS/zB2x0owRg7qZHGydfx fUcf2VpGvpto9TCpTzI8HVlfKOGmr9PY5NYZ7rvbxff/lcvGzl9wzIVH7mqou2fPrAnDOnh5jf8xi jXK43+WKNBZ6DwAPcE/rsRKY2F4FG6zA+wmG3BNFUqDuDbwU83i/p1mN0lvxH1h8XVEfeIcYv0Sh6 ifdcEHMQ==; Received: by zero.zsh.org with local id 1rxvrv-000Mfc-RB; Fri, 19 Apr 2024 21:34:03 +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]:60536) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1rxvqM-000Ljo-Eo; Fri, 19 Apr 2024 21:32:27 +0000 Received: from smtp-qaa.vinc17.net (135.197.67.86.rev.sfr.net [86.67.197.135]) by joooj.vinc17.net (Postfix) with ESMTPSA id EF66D43B; Fri, 19 Apr 2024 23:32:25 +0200 (CEST) Received: by qaa.vinc17.org (Postfix, from userid 1000) id BAB06CA0117; Fri, 19 Apr 2024 23:32:25 +0200 (CEST) Date: Fri, 19 Apr 2024 23:32:25 +0200 From: Vincent Lefevre To: zsh-users@zsh.org Subject: Re: How to propagate SIGTERM to the foreground job, if any? Message-ID: <20240419213225.GA146837@qaa.vinc17.org> Mail-Followup-To: zsh-users@zsh.org References: <20240419171752.GA48158@cventin.lip.ens-lyon.fr> <20240419190027.GA109916@joooj.vinc17.net> 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: 29840 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 13:06:12 -0700, Bart Schaefer wrote: > On Fri, Apr 19, 2024 at 12:00 PM Vincent Lefevre wrote: > > > > 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) > > I don't understand how you're determining that the leader is an ancestor. > > That you have job control at all implies this is an interactive shell. > When zsh starts interactively, it attaches to the TTY and makes itself > the group leader. No, this is a script. You can test with #!/usr/bin/env zsh setopt TRAPS_ASYNC echo $$ trap "trap - TERM; kill %1 $$" TERM xterm echo end and type "kill " with the output by the script. This kills both xterm and the script (no "end" output). Without the %1, xterm isn't killed. This shows that one can get the associated job of the foreground command. > > But then, why does "kill %%" work? > > It doesn't. Indeed, it doesn't, but %1 works (this was what I actually tried, and I thought I had tried %% too, which I actually did only with ${jobstates:+%%} I think). -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)