diff options
author | Marc Hoersken <info@marc-hoersken.de> | 2013-04-06 11:56:04 +0200 |
---|---|---|
committer | Marc Hoersken <info@marc-hoersken.de> | 2013-04-06 11:56:04 +0200 |
commit | ac09b5a92bec0da6109b58856094229a77df5eb8 (patch) | |
tree | f15082331a62803eaf559d4dc78ea4b564e28732 /tests | |
parent | 91252d9fb9ef478c8cb47745ea0088909e7ad589 (diff) |
ftp.pm: Made Perl testsuite able to handle Windows processes
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ftp.pm | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ftp.pm b/tests/ftp.pm index ae41849d8..b38745120 100644 --- a/tests/ftp.pm +++ b/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); |