diff options
author | Chris Williams <chris@bingosnet.co.uk> | 2009-11-08 23:27:37 +0000 |
---|---|---|
committer | Chris Williams <chris@bingosnet.co.uk> | 2009-11-08 23:27:37 +0000 |
commit | 0c2c01a488f0e58de42eaab295cc532ab33511a0 (patch) | |
tree | c7bbaae22d3829ffa03245f2ccfc51245770ef7a /cpan/IPC-Cmd/t/01_IPC-Cmd.t | |
parent | b327b36f413e77afd7eed00e6517a0e8cb961c48 (diff) | |
download | perl-0c2c01a488f0e58de42eaab295cc532ab33511a0.tar.gz |
Update IPC::Cmd to cpan version 0.51_01
Changes for 0.51_01 Sun Nov 8 22:36:33 GMT 2009
=================================================
* Apply patch from Petya Kohts, RT #50398, which adds
run_forked()
Diffstat (limited to 'cpan/IPC-Cmd/t/01_IPC-Cmd.t')
-rw-r--r-- | cpan/IPC-Cmd/t/01_IPC-Cmd.t | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/cpan/IPC-Cmd/t/01_IPC-Cmd.t b/cpan/IPC-Cmd/t/01_IPC-Cmd.t index eca515ec0c..0773479ad4 100644 --- a/cpan/IPC-Cmd/t/01_IPC-Cmd.t +++ b/cpan/IPC-Cmd/t/01_IPC-Cmd.t @@ -9,8 +9,8 @@ use Test::More 'no_plan'; my $Class = 'IPC::Cmd'; my $AClass = $Class . '::TimeOut'; -my @Funcs = qw[run can_run QUOTE]; -my @Meths = qw[can_use_ipc_run can_use_ipc_open3 can_capture_buffer]; +my @Funcs = qw[run can_run QUOTE run_forked]; +my @Meths = qw[can_use_ipc_run can_use_ipc_open3 can_capture_buffer can_use_run_forked]; my $IsWin32 = $^O eq 'MSWin32'; my $Verbose = @ARGV ? 1 : 0; @@ -155,6 +155,23 @@ push @Prefs, [ 0, 0 ], [ 0, 0 ]; } } } + +unless ( IPC::Cmd->can_use_run_forked ) { + ok(1, "run_forked not available on this platform"); + exit; +} + +{ + my $cmd = "echo out ; echo err >&2 ; sleep 4"; + my $r = run_forked($cmd, {'timeout' => 1}); + + ok(ref($r) eq 'HASH', "executed: $cmd"); + ok($r->{'timeout'} eq 1, "timed out"); + ok($r->{'stdout'}, "stdout: " . $r->{'stdout'}); + ok($r->{'stderr'}, "stderr: " . $r->{'stderr'}); +} + + __END__ ### special call to check that output is interleaved properly { my $cmd = [$^X, File::Spec->catfile( qw[src output.pl] ) ]; @@ -219,6 +236,4 @@ __END__ like( $err,qr/^$AClass/," Error '$err' mentions $AClass" ); } } - - |