mirror of
https://github.com/curl/curl.git
synced 2025-01-24 14:15:18 +08:00
ftp.pm: Made Perl testsuite able to handle Windows processes
This commit is contained in:
parent
91252d9fb9
commit
ac09b5a92b
22
tests/ftp.pm
22
tests/ftp.pm
@ -63,6 +63,14 @@ sub processexists {
|
||||
my $pid = pidfromfile($pidfile);
|
||||
|
||||
if($pid > 0) {
|
||||
# verify if currently existing Windows process
|
||||
if($^O eq "msys") {
|
||||
my $filter = "-fi \"PID eq $pid\"";
|
||||
my $result = `tasklist $filter 2>nul`;
|
||||
if(index($result, "$pid") != -1) {
|
||||
return $pid;
|
||||
}
|
||||
}
|
||||
# verify if currently alive
|
||||
if(kill(0, $pid)) {
|
||||
return $pid;
|
||||
@ -222,6 +230,13 @@ sub killsockfilters {
|
||||
printf("* kill pid for %s-%s => %d\n", $server,
|
||||
($proto eq 'ftp')?'ctrl':'filt', $pid) if($verbose);
|
||||
kill("KILL", $pid);
|
||||
if($^O eq "msys") {
|
||||
my $filter = "-fi \"PID eq $pid\"";
|
||||
my $result = `tasklist $filter 2>nul`;
|
||||
if(index($result, "$pid") != -1) {
|
||||
system("taskkill -f $filter >nul 2>&1");
|
||||
}
|
||||
}
|
||||
waitpid($pid, 0);
|
||||
}
|
||||
unlink($pidfile) if(-f $pidfile);
|
||||
@ -236,6 +251,13 @@ sub killsockfilters {
|
||||
printf("* kill pid for %s-data => %d\n", $server,
|
||||
$pid) if($verbose);
|
||||
kill("KILL", $pid);
|
||||
if($^O eq "msys") {
|
||||
my $filter = "-fi \"PID eq $pid\"";
|
||||
my $result = `tasklist $filter 2>nul`;
|
||||
if(index($result, "$pid") != -1) {
|
||||
system("taskkill -f $filter >nul 2>&1");
|
||||
}
|
||||
}
|
||||
waitpid($pid, 0);
|
||||
}
|
||||
unlink($pidfile) if(-f $pidfile);
|
||||
|
Loading…
Reference in New Issue
Block a user