# New Ticket Created by  "Tokuhiro Matsuno" 
# Please include the string:  [perl #126277]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=126277 >


When call `run` method in IO:Socket::Async.listen routine, perl6-m exits 
unexpectedly on Mac OS X.

Following test code pass on linux. But it fails on linux.

```
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use 5.010000;
use autodie;

use Test::More;
use IO::Socket::INET;

my $pid = fork();
if ($pid > 0) { # parent
    say 'sleep';

    sleep 3;

    say 'connect';
    my $sock = IO::Socket::INET->new(PeerAddr => 'localhost:5000');
    $sock or die;
    my $msg = <$sock>;
    is $msg, "yo\n";
    kill 'TERM', $pid;
    waitpid $pid, 0;
} elsif ($pid == 0) {
    say 'executing server';
    exec 'perl6-m', '-e', <<'EOF';
use v6;

sub MAIN($port=5000) {
    react {
        whenever IO::Socket::Async.listen('127.0.0.1', $port) -> $conn {
            run 'ls'; # process exits at here.
            await $conn.print("yo\n");
            $conn.close();
        }
    }
}
EOF
} else {
die 'fork failed';
}


done_testing;
```

output on linux:
```
sleep
executing server
connect
foo.pl6  hoge.pl  projects.json
ok 1
1..1
```

output on mac:
```
sleep
executing server
connect
LICENSE  META6.json  README.md  bin  eg  hoge.pl  lib  server.pl6  t
not ok 1
#   Failed test at hoge.pl line 21.
#          got: undef
#     expected: 'yo
# '
1..1
# Looks like you failed 1 test of 1.
```

Version is:
```
This is perl6 version 2015.09-210-gef814c3 built on MoarVM version 
2015.09-39-g1434283
```

Reply via email to