On Wed, 18 Apr 2007, Steve Hay wrote: > Jan Dubois wrote: > > Therefore `kill(15, undef)` should send signal 15 to all processes > > in the current process group, including the process issuing the > > kill() call itself. > > Is kill(15, $pid) supposed to work on Windows? I find that it has no > effect (at least when $pid is another perl.exe process). It works for me (see sample at the end of the message): D:\tmp>perl int.pl cmd=d:\perl820\bin\perl.exe -x int.pl 5032 pid=4600 4332 starting 5032 kill=1 Terminating on signal SIGBREAK(21) 5032 done You'll notice that SIGTERM(15) is mapped to SIGBREAK(21) on Windows. > Also, kill(9, $pid) kills another perl.exe process OK, but > > perl -le "kill 9, undef; print 'Hi'" > > doesn't kill the current perl process: the program prints 'Hi' and > exits normally. Same with kill(9, 0) in place of kill(9, undef). The whole process group semantics don't really map well to Windows. I'll write a separate message to explain how my killpg() implementation on Windows is actually quite different from the POSIX semantics. Cheers, -Jan ------------------ test.pl -------------------- use strict; use warnings; $| = 1; my $cmd = qq($^X -x $0); print "cmd=$cmd\n"; my $pid = system(1, $cmd); print "$$ pid=$pid\n"; sleep 2; printf "$$ kill=%s\n", kill 15, $pid; sleep 5; print "$$ done\n"; __END__ #!perl use strict; use warnings; $| = 1; print "$$ starting\n"; sleep 5; print "$$ terminating\n";Thread Previous | Thread Next