test-class icon indicating copy to clipboard operation
test-class copied to clipboard

fork() breaks in Windows

Open szabgab opened this issue 4 years ago • 1 comments

#!/usr/bin/env perl

use strict;
use warnings;
use autodie;

use parent qw( Test::Class );

sub test_fork : Tests() {
        my $pid = fork or do {
                exit;
        };

        waitpid $pid, 0;
}

__PACKAGE__->new()->runtests() if !caller;

^^ The above breaks in Windows. It gives the following error:

# 
# main->test_fork
Free to wrong pool 2db2a30 not 22829c0 at t/tcbug.pl line 11.
 at t/tcbug.pl line 10.
        Test::Class::_run_method(main=HASH(0x2f98a68), "test_fork", ARRAY(0x30ae5f8)) called at C:/Strawberry/perl/site/lib/Test/Class.pm line 402
        Test::Class::runtests(main=HASH(0x2f98a68)) called at t/tcbug.pl line 17
Dubious, test returned 5 (wstat 1280, 0x500)
No subtests run 

Test Summary Report
-------------------
t/tcbug.pl (Wstat: 1280 Tests: 0 Failed: 0)
  Non-zero exit status: 5
  Parse errors: No plan found in TAP output
Files=1, Tests=0,  2 wallclock secs ( 0.05 usr +  0.00 sys =  0.05 CPU)
Result: FAIL

I don’t have a fix at this time.

-FG

Original: https://rt.cpan.org/Public/Bug/Display.html?id=128491

szabgab avatar Feb 23 '21 05:02 szabgab