]> Sergey Matveev's repositories - public-inbox.git/commitdiff
t/spawn: fix test reliability
authorEric Wong <e@yhbt.net>
Tue, 7 Jul 2020 06:17:24 +0000 (06:17 +0000)
committerEric Wong <e@yhbt.net>
Tue, 7 Jul 2020 20:38:57 +0000 (20:38 +0000)
Since Perl doesn't internally use a self-pipe for
sleep/select/poll/etc, wake up every 10ms to ensure
it can see the SIGCHLD; since neither signalfd nor EVFILT_SIGNAL
are always available.

Fixes: 761baa2a300e4268 ("spawn: unblock SIGCHLD in subprocess")
t/spawn.t

index fd669e222e1bd7031e1a13cb7ebd23580930a1c1..a0019202a85aaf8da3958c86a94423fe8ce82ab8 100644 (file)
--- a/t/spawn.t
+++ b/t/spawn.t
@@ -29,7 +29,7 @@ elsif ($pid > 0) {
        $? == 0 or die "child err: $>";
        $SIG{CHLD} = sub { print "HI\n"; exit };
        print "RDY $$\n";
-       sleep while 1;
+       select(undef, undef, undef, 0.01) while 1;
 }
 EOF
        my $oldset = PublicInbox::Sigfd::block_signals();