You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by si...@apache.org on 2022/06/08 02:26:05 UTC

svn commit: r1901738 - /spamassassin/trunk/t/timeout.t

Author: sidney
Date: Wed Jun  8 02:26:05 2022
New Revision: 1901738

URL: http://svn.apache.org/viewvc?rev=1901738&view=rev
Log:
bug 8005 - sleep() required in test in Windows where select() is needed in other OS

Modified:
    spamassassin/trunk/t/timeout.t

Modified: spamassassin/trunk/t/timeout.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/timeout.t?rev=1901738&r1=1901737&r2=1901738&view=diff
==============================================================================
--- spamassassin/trunk/t/timeout.t (original)
+++ spamassassin/trunk/t/timeout.t Wed Jun  8 02:26:05 2022
@@ -13,11 +13,16 @@ require Mail::SpamAssassin::Timeout;
 
 # attempt to circumvent an advice not to mix alarm() with sleep();
 # interaction between alarms and sleeps is unspecified;
-# select() might be restarted on a signal
+# select() might be restarted on a signal.
+# Windows alarm emulation works with sleep, doesn't work with select() timeouts
 #
 sub mysleep($) {
   my($dt) = @_;
-  select(undef, undef, undef, 0.1)  for 1..int(10*$dt);
+  if ($RUNNING_ON_WINDOWS) {
+    sleep($dt);
+  } else {
+    select(undef, undef, undef, 0.1) for 1..int(10*$dt);
+  }
 }
 
 my($r,$t,$t1,$t2);