4 use Test2::Tools::Tiny;
5 use Test2::API qw/context test2_stack/;
6 use Test2::Util qw/CAN_FORK/;
9 skip_all "System cannot fork" unless CAN_FORK;
10 skip_all "known to fail on $]" if $] le "5.006002";
15 pipe(my ($read, $write));
18 my $hub = test2_stack()->new_hub();
21 die "Failed to fork" unless defined $pid;
25 test2_stack()->pop($hub);
31 is($err, 255, "Exit code was not masked");
32 ok($err != 100, "Did not hit the safety exit");
40 open(STDERR, '>', my $x);
41 my $ctx = context(hub => $hub, level => -1);
42 my $clone = $ctx->snapshot;
44 $clone->ok(0, "Should not see this");
45 print STDERR "\n\nSomething went wrong!!!!\n\n";
46 exit 100; # Safety exit
50 # The rest of this is to make sure nothing that happens when reading the event
56 die "Failed to fork" unless defined $pid;
60 ok(1, "Test in forked process");