ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/t/03_child.t
(Generate patch)

Comparing AnyEvent/t/03_child.t (file contents):
Revision 1.7 by root, Sun Nov 25 14:08:12 2007 UTC vs.
Revision 1.10 by root, Fri May 23 16:36:02 2008 UTC

1$|=1; 1$|=1;
2BEGIN { print "1..7\n" } 2
3BEGIN {
4 # check for broken perls
5 if ($^O =~ /mswin32/i) {
6 my $ok;
7 local $SIG{CHLD} = sub { $ok = 1 };
8 kill 'CHLD', 0;
9
10 unless ($ok) {
11 print <<EOF;
121..0 # Your perl interpreter is badly BROKEN. Child watchers will not work, ever. Try upgrading to a newer perl or a working perl (cygwin's perl is known to work). If that is not an option, you should be able to use the remaining functionality of AnyEvent, but child watchers WILL NOT WORK.
13EOF
14 exit 0;
15 }
16 }
17}
18
19BEGIN {
20 print "1..7\n"
21}
3 22
4use AnyEvent; 23use AnyEvent;
5use AnyEvent::Impl::Perl; 24use AnyEvent::Impl::Perl;
6 25
7print "ok 1\n"; 26print "ok 1\n";
27
28AnyEvent::detect; # force-load event model
8 29
9my $pid = fork; 30my $pid = fork;
10 31
11defined $pid or die "unable to fork"; 32defined $pid or die "unable to fork";
12 33
36 print $pid2 == $_[0] ? "" : "not ", "ok 5 # $pid2 == $_[0]\n"; 57 print $pid2 == $_[0] ? "" : "not ", "ok 5 # $pid2 == $_[0]\n";
37 print 7 == ($_[1] >> 8) ? "" : "not ", "ok 6 # 7 == $_[1] >> 8 ($_[1])\n"; 58 print 7 == ($_[1] >> 8) ? "" : "not ", "ok 6 # 7 == $_[1] >> 8 ($_[1])\n";
38 $cv2->broadcast; 59 $cv2->broadcast;
39}); 60});
40 61
62my $error = AnyEvent->timer (after => 5, cb => sub {
63 print <<EOF;
64Bail out! No child exit detected. This is either a bug in AnyEvent or a bug in your Perl (mostly some windows distributions suffer from that): child watchers might not work properly on this platform. You can force installation of this module if you do not rely on child watchers, or you could upgrade to a working version of Perl for your platform.\n";
65EOF
66 exit 0;
67});
68
41$cv2->wait; 69$cv2->wait;
42 70
43print "ok 7\n"; 71print "ok 7\n";
44 72
45 73

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines