AnyEvent-Proc

 view release on metacpan or  search on metacpan

t/000-simple.t  view on Meta::CPAN

#!perl

use Test::Most;
use AnyEvent::Proc;
use Env::Path;

BEGIN {
    delete @ENV{qw{ LANG LANGUAGE }};
    $ENV{LC_ALL} = 'C';
}

plan tests => 5;

SKIP: {
    my ($bin) = Env::Path->PATH->Whence('xxxxcat');
    skip "test, reason: executable 'cat' not available", 5 unless $bin;
    my $proc = AnyEvent::Proc->new( bin => $bin, ttl => 5 );
    ok $proc->alive(), 'proc is alive';
    $proc->writeln($$);
    ok $proc->alive(), 'proc is still alive (1)';
    is $proc->readline() => $$, 'readline returns my pid';
    ok $proc->alive(), 'proc is still alive (2)';
    $proc->fire();
    is $proc->wait() => 0, 'wait ok, status is 0';
}

done_testing;



( run in 0.643 second using v1.01-cache-2.11-cpan-df04353d9ac )