Gentoo Archives: gentoo-user

From: Moshe Kaminsky <kaminsky@××××××××××××.il>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: [OT] kill a child and suicide
Date: Thu, 04 May 2006 18:46:38
Message-Id: 20060504183511.GA16206@kaminsky
In Reply to: Re: [gentoo-user] Re: [OT] kill a child and suicide by Hans-Werner Hilse
1 * Hans-Werner Hilse <hilse@×××.de> [04/05/06 21:00]:
2 > Hi,
3 >
4 > On Thu, 4 May 2006 18:55:28 +0300
5 > Moshe Kaminsky <kaminsky@××××××××××××.il> wrote:
6 >
7 > > Funny, I just tried the same, and it worked. It also didn't print any
8 > > "after" (appropriately, since the sig handler includes 'exit'), and I
9 > > didn't find any sleep process. Maybe it was from some different
10 > > experiment?
11 >
12 > I don't think so. You probably sent the signal to the child process
13 > (CTRL-C, perhaps?) and the script at once, not to the parent only.
14 >
15 > proper way would be to try it like this:
16 >
17 > ./test.sh &
18 > # wait some short time
19 > kill -TERM $!
20 >
21 > After that I see that the child process is still running.
22
23 You are right. I was using 'kill -TERM %1', which sends the signal to
24 the whole group, I guess. Anyway, I just tried the analogous thing with
25 perl, and it does work. I wonder what is the reasoning in the bash case.
26
27 Moshe