Deutsch   English   Français   Italiano  
<slrnv3vr2g.1gfp.naddy@lorvorc.mips.inka.de>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!2.eu.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!news.szaf.org!inka.de!mips.inka.de!.POSTED.localhost!not-for-mail
From: Christian Weisgerber <naddy@mips.inka.de>
Newsgroups: comp.unix.shell
Subject: Re: Cleaning up background processes
Date: Sat, 11 May 2024 22:08:16 -0000 (UTC)
Message-ID: <slrnv3vr2g.1gfp.naddy@lorvorc.mips.inka.de>
References: <slrnv3fm5e.jrj.naddy@lorvorc.mips.inka.de>
 <v1ah87$l0a8$1@news.xmission.com> <v1gpdq$3me9$1@dont-email.me>
 <slrnv3v0m5.17e3.naddy@lorvorc.mips.inka.de>
 <v1ogll$rrf5$1@news.xmission.com>
Injection-Date: Sat, 11 May 2024 22:08:16 -0000 (UTC)
Injection-Info: lorvorc.mips.inka.de; posting-host="localhost:::1";
	logging-data="50561"; mail-complaints-to="usenet@mips.inka.de"
User-Agent: slrn/1.0.3 (FreeBSD)
Bytes: 1748
Lines: 29

On 2024-05-11, Kenny McCormack <gazelle@shell.xmission.com> wrote:

>>> I have to ask:  Why couldn't you trap "kill -1 0" INT?
>>
>>        trap "kill -TERM 0" INT
>
> I don't get it.  Is there any significant difference between hitting it with
> TERM vs. HUP?

I find "Terminated" less confusing than "Hangup", that's all.
Of course it would be even better if I could keep the asynchronous
process from ignoring SIGINT in the first place... Oh, maybe I can!

Instead of

    foo &

I can run

    (trap - INT; exec foo) &

and indeed that seems to restore the default behavior, i.e., terminate
the process, for both FreeBSD sh and bash.  Anybody see any problem
with that approach?

I'd also be interested in historical insights how this "ignore SIGINT
for asynchronous processes" behavior came to be.

-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de