mirror of
https://github.com/moparisthebest/curl
synced 2024-11-11 20:15:03 -05: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);
|
my $pid = pidfromfile($pidfile);
|
||||||
|
|
||||||
if($pid > 0) {
|
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
|
# verify if currently alive
|
||||||
if(kill(0, $pid)) {
|
if(kill(0, $pid)) {
|
||||||
return $pid;
|
return $pid;
|
||||||
@ -222,6 +230,13 @@ sub killsockfilters {
|
|||||||
printf("* kill pid for %s-%s => %d\n", $server,
|
printf("* kill pid for %s-%s => %d\n", $server,
|
||||||
($proto eq 'ftp')?'ctrl':'filt', $pid) if($verbose);
|
($proto eq 'ftp')?'ctrl':'filt', $pid) if($verbose);
|
||||||
kill("KILL", $pid);
|
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);
|
waitpid($pid, 0);
|
||||||
}
|
}
|
||||||
unlink($pidfile) if(-f $pidfile);
|
unlink($pidfile) if(-f $pidfile);
|
||||||
@ -236,6 +251,13 @@ sub killsockfilters {
|
|||||||
printf("* kill pid for %s-data => %d\n", $server,
|
printf("* kill pid for %s-data => %d\n", $server,
|
||||||
$pid) if($verbose);
|
$pid) if($verbose);
|
||||||
kill("KILL", $pid);
|
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);
|
waitpid($pid, 0);
|
||||||
}
|
}
|
||||||
unlink($pidfile) if(-f $pidfile);
|
unlink($pidfile) if(-f $pidfile);
|
||||||
|
Loading…
Reference in New Issue
Block a user