]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: use native Sleep function as fallback on Windows
authorMarc Hoersken <info@marc-hoersken.de>
Sat, 7 Mar 2020 10:01:57 +0000 (11:01 +0100)
committerMarc Hoersken <info@marc-hoersken.de>
Sat, 7 Mar 2020 10:02:43 +0000 (11:02 +0100)
Reviewed-By: Daniel Stenberg
Closes #5054

tests/ftp.pm

index f7298bce617e0049281433fdda86edf86eb2c63b..5e92ce7f94b0324088edde6de0124cf194631b68 100644 (file)
@@ -25,6 +25,11 @@ BEGIN {
     eval {
         no warnings "all";
         require Time::HiRes;
+    };
+    # portable sleeping falls back to native Sleep on Win32
+    eval {
+        no warnings "all";
+        require Win32;
     }
 }
 
@@ -50,8 +55,8 @@ sub portable_sleep {
     if($Time::HiRes::VERSION) {
         Time::HiRes::sleep($seconds);
     }
-    elsif ($seconds > 1 && ($^O eq 'MSWin32' || $^O eq 'msys')) {
-        sleep($seconds);
+    elsif ($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys') {
+        Win32::Sleep($seconds*1000);
     }
     else {
         select(undef, undef, undef, $seconds);