AnyEvent-Open3-Simple
view release on metacpan or search on metacpan
},
on_exit => sub {
my $proc = shift; # isa AnyEvent::Open3::Simple::Process
my $exit_value = shift; # integer
my $signal = shift; # integer
say 'exit value: ', $exit_value;
say 'signal: ', $signal;
$done->send;
},
on_error => sub {
my $error = shift; # the exception thrown by IPC::Open3::open3
my $program = shift; # string
my @args = @_; # list of arguments
warn "error: $error";
$done->send;
},
);
$ipc->run('echo', 'hello there');
$done->recv;
Called after the process is created, but before the run method
returns (that is, it does not wait to re-enter the event loop first).
In versions 0.78 and better, this event also gets the program name
and arguments passed into the run method.
* on_error ($error, $program, @arguments)
Called when there is an execution error, for example, if you ask to
run a program that does not exist. No process is passed in because
the process failed to create. The error passed in is the error thrown
by IPC::Open3 (typically a string which begins with "open3: ...").
In some environments open3 is unable to detect exec errors in the
child, so you may not be able to rely on this event. It does seem to
work consistently on Perl 5.14 or better though.
Different environments have different ways of handling it when you
ask to run a program that doesn't exist. On Linux and Cygwin, this
will raise an on_error event, on MSWin32 it will not trigger a
on_error and instead cause a normal exit with a exit value of 1.
lib/AnyEvent/Open3/Simple.pm view on Meta::CPAN
},
on_exit => sub {
my $proc = shift; # isa AnyEvent::Open3::Simple::Process
my $exit_value = shift; # integer
my $signal = shift; # integer
say 'exit value: ', $exit_value;
say 'signal: ', $signal;
$done->send;
},
on_error => sub {
my $error = shift; # the exception thrown by IPC::Open3::open3
my $program = shift; # string
my @args = @_; # list of arguments
warn "error: $error";
$done->send;
},
);
$ipc->run('echo', 'hello there');
$done->recv;
lib/AnyEvent/Open3/Simple.pm view on Meta::CPAN
In versions 0.78 and better, this event also gets the program name
and arguments passed into the L<run|AnyEvent::Open3::Simple#run>
method.
=item * C<on_error> ($error, $program, @arguments)
Called when there is an execution error, for example, if you ask
to run a program that does not exist. No process is passed in
because the process failed to create. The error passed in is
the error thrown by L<IPC::Open3> (typically a string which begins
with "open3: ...").
In some environments open3 is unable to detect exec errors in the
child, so you may not be able to rely on this event. It does
seem to work consistently on Perl 5.14 or better though.
Different environments have different ways of handling it when
you ask to run a program that doesn't exist. On Linux and Cygwin,
this will raise an C<on_error> event, on C<MSWin32> it will
not trigger a C<on_error> and instead cause a normal exit
t/anyevent_open3_simple__stdin.t view on Meta::CPAN
};
}
subtest constructor => sub {
plan tests => 2;
my $in='';
eval { AnyEvent::Open3::Simple->new( stdin => \$in ) };
isnt $@, '', 'throws exception';
like $@, qr{stdin passed into AnyEvent::Open3::Simple\-\>new no longer supported}, 'has message';
note "error=$@";
};
( run in 0.621 second using v1.01-cache-2.11-cpan-496ff517765 )