Re: kill doesn't work correctly

Bill Luebkert <[email protected]>
Newsgroups gmane.comp.lang.perl.active-perl
Message-ID <[email protected]>
Jan Dubois wrote:
> 
> I can't reproduce the problem with either build 1006 nor 1007
> (the only 5.10.1 builds of ActivePerl released so far), so I have
> no idea why this is failing for you.
> 
> I checked both Windows XP and Windows 7, FWIW.

I can reproduce it in 5.8 B820.  I run a simple looping perl script that
prints out the pid in one window and try to kill it from another with
the same script (using argv to differentiate which function):

use strict;
use warnings;

# sleep if no argv

if (not @ARGV) {
	print "pid=$$ - going into sleep loop\n";
	while (1) { sleep 5; }
	exit;
}

# else try to kill argv (signal and PID as args)

(my $sig, $pid) = @ARGV;

print "Attempting to kill $sig, $pid\n";
my $ret = kill $sig, $pid;
print "kill returned $ret\n";
exit;

__END__

	Window 1:

<24> p xx.pl
pid=6508 - going into sleep loop

	Window 2:

<472> p xx.pl 0 6508
Attempting to kill 0, 6508	Attempt to test if 6508 is there - good return
kill returned 1

<473> p xx.pl 0 6509		Attempt to kill non-existent 6509 (checked taskmaster) and get a good return
Attempting to kill 0, 6509
kill returned 1

<474> p xx.pl 9 6509		Killed 6508 using 6509 as PID and sig of 9 ???
Attempting to kill 9, 6509
kill returned 1

<475> p xx.pl 9 6509		Here we get a proper 0 return when repeating
Attempting to kill 9, 6509
kill returned 0

Strange stuff.

I get similar weird returns from OpenProcess using API.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.