HEX
Server: Apache
System: Linux host.fiblib.com 5.14.0-570.58.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 29 06:24:11 EDT 2025 x86_64
User: scientificreligi (1062)
PHP: 8.0.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/share/doc/perl-Test-Simple/t/regression/fork_first.t
use Test2::Tools::Tiny;
use strict;
use warnings;

use Test2::IPC;
use Test2::Util qw/CAN_THREAD CAN_REALLY_FORK/;

skip_all 'No IPC' unless CAN_REALLY_FORK || CAN_THREAD;

if (CAN_REALLY_FORK) {
    my $pid = fork;
    die "Failed to fork: $!" unless defined $pid;
    if ($pid) {
        waitpid($pid, 0)
    }
    else {
        ok(1, "Pass fork");
        exit 0;
    }
}

if (CAN_THREAD) {
    require threads;
    my $thread = threads->create(
        sub {
            ok(1, "Pass thread");
        }
    );

    $thread->join;
}

done_testing;