3 use open ":std", ":encoding(UTF-8)";
7 use IO::Poll qw(POLLOUT);
12 my $jobs = $ENV{'MAKE_JOBS'} // 1;
14 my $poll = IO::Poll->new();
16 open(my $kid, '|-', './mexp') or die "can't exec ./mexp: $!";
17 $poll->mask($kid => POLLOUT);
21 die "poll: $!" if $poll->poll() == -1;
22 my @handles = $poll->handles(POLLOUT) or die "no procs ready?";
23 my $handle = $handles[int(rand(@handles))];
24 say $handle $_ foreach @_;
27 unveil("./mexp", "rx") or die "unveil mexp: $!";
28 pledge("stdio proc exec") or die "pledge: $!";
32 print; # continue the pipeline
35 m/^([^ ]+) <([^>]+)> (.+)(\d{4}-\d{2}-\d{2} \d{2}:\d{2}) <([^>]+)> (.*)/;
36 die "can't parse: $_" unless defined $1;
38 my $level = length($3) - 1;
39 $level = 10 if $3 =~ m/\.\.\d{2}\.\./;
41 if ($level == 0 && @thread) {
49 process @thread if @thread;