545
|
12 |
8 |
0 |
$self->[2] ||= &AE::io($self->[1], 1, sub {
do {
if (ref $self->[0][0]) {
unless (IO::FDPass::send(fileno $self->[1], fileno ${$self->[0][0];})) {
return if $! == 11 or $! == 11;
undef $self->[2];
die "AnyEvent::Fork: file descriptor send failure: $!";
};
shift @{$$self[0];};
}
else {
my $len = syswrite($self->[1], $self->[0][0]);
unless ($len) {
return if $! == 11 or $! == 11;
undef $self->[2];
die "AnyEvent::Fork: command write failure: $!";
};
substr $self->[0][0], 0, $len, "";
shift @{$$self[0];} unless length $self->[0][0];
}
} while @{$self->[0];};
undef $self->[2];
if ($self->[4]) {
$self->[4]->($self->[1]);
@$self = ();
};
}
) |