7 # open2/3 supported on win32
8 && $^O ne 'MSWin32' && $^O ne 'NetWare')
10 Test::More->import(skip_all => 'open2/3 not available with MSWin32+Netware');
14 $SIG{__WARN__} = sub { die @_ };
19 use Test::More tests => 15;
24 if ($^O eq 'MSWin32' || $^O eq 'NetWare') {
35 my $pid = open2('READ', 'WRITE', $perl, '-e', cmd_line('print scalar <STDIN>'));
36 cmp_ok($pid, '>', 1, 'got a sane process ID');
37 ok(print WRITE "hi kid\n");
38 like(<READ>, qr/^hi kid\r?\n$/);
39 ok(close(WRITE), "closing WRITE: $!");
40 ok(close(READ), "closing READ: $!");
41 my $reaped_pid = waitpid $pid, 0;
42 is($reaped_pid, $pid, "Reaped PID matches");
43 is($?, 0, '$? should be zero');
47 my $pid = IPC::Open2::open2('KAZOP', 'WRITE', $perl, '-e',
48 main::cmd_line('print scalar <STDIN>'));
49 main::cmp_ok($pid, '>', 1, 'got a sane process ID');
50 main::ok(print WRITE "hi kid\n");
51 main::like(<KAZOP>, qr/^hi kid\r?\n$/);
52 main::ok(close(WRITE), "closing WRITE: $!");
53 main::ok(close(KAZOP), "closing READ: $!");
54 my $reaped_pid = waitpid $pid, 0;
55 main::is($reaped_pid, $pid, "Reaped PID matches");
56 main::is($?, 0, '$? should be zero');
59 $pid = eval { open2('READ', '', $perl, '-e', cmd_line('print scalar <STDIN>')) };
60 like($@, qr/^open2: Modification of a read-only value attempted at /,
61 'open2 faults read-only parameters correctly') or do {waitpid $pid, 0};