| AnyEvent-Subprocess documentation | Contained in the AnyEvent-Subprocess distribution. |
AnyEvent::Subprocess::Done - represents a completed subprocess run
version 1.102912
We are $done in a sequence like:
my $job = AnyEvent::Subprocess->new ( ... );
my $run = $job->run;
$run->delegate('stdin')->push_write('Hello, my child!');
say "Running child as ", $run->child_pid;
$run->kill(11) if $you_enjoy_that_sort_of_thing;
my $done = $job->delegate('completion_condvar')->recv;
say "Child exited with signal ", $done->exit_signal;
say "Child produced some stdout: ",
$done->delegate('stdout_capture')->output;
An instance of this class is returned to your on_completion
callback when the child process exists.
Returns the delegate named $name.
$? from waitpid on the child. Parsed into the various fields
below:
The value the child supplied to exit. (0 if "exit 0", etc.)
The signal number the child was killed by, if any.
True if the child dumped core.
True if the exit_status is 0. If this is false, your process dumped core, exited due to a signal, or exited with a value other than 0.
Jonathan Rockway <jrockway@cpan.org>
This software is copyright (c) 2011 by Jonathan Rockway.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
| AnyEvent-Subprocess documentation | Contained in the AnyEvent-Subprocess distribution. |
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;
__END__