AnyEvent-Subprocess
view release on metacpan or search on metacpan
lib/AnyEvent/Subprocess/Done.pm view on Meta::CPAN
package AnyEvent::Subprocess::Done;
BEGIN {
$AnyEvent::Subprocess::Done::VERSION = '1.102912';
}
# ABSTRACT: represents a completed subprocess run
use Moose;
use namespace::autoclean;
use AnyEvent::Subprocess::Types qw(DoneDelegate);
use POSIX qw(WIFEXITED WEXITSTATUS WIFSIGNALED WIFEXITED WTERMSIG);
with 'AnyEvent::Subprocess::Role::WithDelegates' => {
type => DoneDelegate,
};
# $? is the exit_status, the argument to exit ("exit 0") is exit_value
# if the process was killed, exit_signal contains the signal that killed it
has 'exit_status' => (
is => 'ro',
isa => 'Int',
required => 1,
);
has [qw[dumped_core exited]] => (
is => 'ro',
isa => 'Bool',
lazy_build => 1,
);
has [qw[exit_value exit_signal]] => (
is => 'ro',
isa => 'Int',
lazy_build => 1,
);
sub _build_exited {
my $self = shift;
return WIFEXITED($self->exit_status);
}
sub _build_exit_value {
my $self = shift;
return WEXITSTATUS($self->exit_status);
}
sub _build_exit_signal {
my $self = shift;
return WIFSIGNALED($self->exit_status) && WTERMSIG($self->exit_status);
}
sub _build_dumped_core {
my $self = shift;
return 0 if $self->exit_status < 0;
return $self->exit_status & 128;
}
sub is_success {
my $self = shift;
return $self->exit_status == 0;
}
__PACKAGE__->meta->make_immutable;
1;
( run in 0.637 second using v1.01-cache-2.11-cpan-39bf76dae61 )