[Emailed to JDB, 27/05/2009. I should have logged it in CPAN/RT instead,
so here it is...]
I've been rebuilding various things with VC9 lately, and came across a
problem in the mod_perl test suite in which the httpd.exe wasn't getting
killed after the tests had finished.
It turns out to be a problem with Win32::Process::KillProcess(), which
seems not to work any more in my VC9 build of perl. I can reproduce the
problem with just this:
use Win32::Process;
my $obj;
Win32::Process::Create(
$obj, 'C:/Windows/Notepad.exe', 'Notepad', 0, NORMAL_PRIORITY_CLASS(), '.'
);
sleep 2;
my $pid = $obj->GetProcessID();
Win32::Process::KillProcess($pid, 0);
If I change the last line to:
$obj->Kill(0);
then it works okay.
The KillProcess() call works okay in a VC8 build of the same version of
perl (5.10.0), with all the same build options, on the same machine, as
the same user.
I don't know what VC9 has done to break things, but if I change the
OpenProcess() permissions used by KillProcess() to match those used by
Open() then it works again with VC9.
The attached patch does this.
This might also resolve the following old CPAN ticket:
http://rt.cpan.org/Public/Bug/Display.html?id=12672
Subject: | killprocess.pat |
Message body not shown because it is not plain text.