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.2 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 DB5C522092 for ; Sun, 21 Apr 2024 19:29:49 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1713720589; b=rB1fr1S+xkcok2QU8InZJg7V6eVhH8RNce6e2GMFMDzI2HVkQKD6fSq5sfHfghLrDCe58znrTd yp8BgoecZaYjcNInjwf308yFtJ+bxGl/aO3ZbeVP2yWYFcSzskqKRdvayiGKsrtMzsgSaKEtjY aJ6aXG127YhMCkX9uG3WReHROM4xavrdT/L6lVmkclMlakD6roVJJHROAISYFVfKXnZjsPVK1f DPB1LrWhOOSsv6eONuqZHtQxHrKCdb5IzJTiCyAaMU9GG3Hxcn3fu6at25+L7QofKGsck1EuhI n4294Cuw218Y/VeZXmI6ZHwTRclZZVtWts+Ii/ymTwW1nA==; 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=1713720589; bh=Exunx6dBTsr7MJcUCCQ0ePcAkhd0iLwzrkyWYz5YV64=; 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=icufD+Ays0RDuB0iYiRSaI48/+K+Q86Qcki/oU93OTj/GRIPNhlWgRh5f/enShjblrYKmFfNsN tPadK60JTYgbRQJVch2naHkstG5znBNjnw2JXZ6W4Ue89wSIEk5L678URVbojiu0z3RyElf6KX n16t1gnEQZaIzfG/fwEKgK3PYX1l9XwkHK1V0z6FfR8hhQpyq19qKFLK+07SDGMAs906IJeX1X ih8fqCd9FuN4Bi/d3Lhjax7fhqndYZZzHxyLDcnWjycl0yjh72y1NYZe887/a1kBth/vNasn2t D9ArbnWAtvOU1Z4DlxHRq74+UqrTGDGxellbxq8xzfS4fQ==; 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=dZZvbsqg9kTdvAwhjWTRbfpirIiSddxPPO36QlJ8YrI=; b=cR1d24zayXyREMGVlKQmQqYrjR dUuw3EdOPFQfET3b2NrPtu5mWMH1E1I8HsNyNIYfPpek663sotd7FD/0ZhWUQjY0+NE8C0D8lqPdy RKkdqgdfyvvXxgXWJEceqkEwoN9u0aG5WBoFt+vjvQQDbFucYFH4Toc7GHfvePYVfC2cg7p5KWGIQ oEDTVk9q9sXW4hF40EbKCfqMcHzWkzHU/HhAly9e0K69bCImgUNnLAU92dlkkECyECXv83x9Cl2tr RSB3YX9qoLppGbj13CaaXxYsZtMAGuV6FYuIJDNa4QSgaLsz7SOTwjculaxKAPEA5iP0eSOfrlU2z EFRZkx8g==; Received: by zero.zsh.org with local id 1ryb0e-000NnQ-RN; Sun, 21 Apr 2024 17:29:48 +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]:37852) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1ryb03-000N7f-BA; Sun, 21 Apr 2024 17:29:12 +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 4C76F49F; Sun, 21 Apr 2024 19:29:10 +0200 (CEST) Received: by qaa.vinc17.org (Postfix, from userid 1000) id 3D6D2CA011A; Sun, 21 Apr 2024 19:29:09 +0200 (CEST) Date: Sun, 21 Apr 2024 19:29:09 +0200 From: Vincent Lefevre To: zsh-users@zsh.org Subject: Re: How to propagate SIGTERM to the foreground job, if any? Message-ID: <20240421172909.GB146837@qaa.vinc17.org> Mail-Followup-To: zsh-users@zsh.org References: <20240419171752.GA48158@cventin.lip.ens-lyon.fr> <20240419190027.GA109916@joooj.vinc17.net> <20240419213225.GA146837@qaa.vinc17.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 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: 29851 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-20 21:09:46 -0700, Bart Schaefer wrote: > > > > But then, why does "kill %%" work? > > > > > > It doesn't. > > > > Indeed, it doesn't, but %1 works > > Except that %1 might be the wrong job number if there are any > background jobs? Yes, that's a potential issue, and that's why I would prefer %%. > Why not do it like this? > > setopt TRAPS_ASYNC > echo $$ > trap 'kill $xterm; exit' TERM > xterm & xterm=$! > wait $xterm > echo end xterm was just a very simple example. In practice, several commands are involved, and among them, there are zsh functions that may need to affect the environment. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)