Class-Usul
view release on metacpan or search on metacpan
lib/Class/Usul/IPC/Cmd.pm view on Meta::CPAN
SimpleStr Str Undef );
use English qw( -no_match_vars );
use File::Basename qw( basename );
use File::DataClass::Types qw( Directory Path );
use File::Spec::Functions qw( devnull rootdir tmpdir );
use IO::Handle;
use IO::Select;
use IPC::Open3;
use Module::Load::Conditional qw( can_load );
use POSIX qw( _exit setsid sysconf WIFEXITED WNOHANG );
use Scalar::Util qw( blessed openhandle weaken );
use Socket qw( AF_UNIX SOCK_STREAM PF_UNSPEC );
use Sub::Install qw( install_sub );
use Try::Tiny;
use Unexpected::Functions qw( TimeOut Unspecified );
use Moo; use warnings NONFATAL => 'all';
our ($CHILD_ENUM, $CHILD_PID);
# Public attributes
lib/Class/Usul/IPC/Cmd.pm view on Meta::CPAN
$self->pidfile->println( $PID );
return;
};
my $_ipc_run_harness = sub {
my ($self, $cmd_ref, @cmd_args) = @_;
if ($self->async) {
is_coderef $cmd_ref->[ 0 ] and $cmd_ref = $cmd_ref->[ 0 ];
my $pidfile = $self->pidfile; weaken( $pidfile );
my $h = IPC::Run::harness( $cmd_ref, @cmd_args, init => sub {
IPC::Run::close_terminal(); $pidfile->println( $PID ) }, '&' );
$h->start; return ( 0, $h );
}
my $h = IPC::Run::harness( $cmd_ref, @cmd_args ); $h->run;
my $rv = $h->full_result || 0; $rv =~ m{ unknown }msx and throw $rv;
return ( $rv, $h );
( run in 0.495 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )