source: trunk/essentials/dev-lang/perl/lib/IPC/Open3.t

Last change on this file was 3181, checked in by bird, 19 years ago

perl 5.8.8

File size: 3.4 KB
Line 
1#!./perl -w
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6 require Config; import Config;
7 if (!$Config{'d_fork'}
8 # open2/3 supported on win32 (but not Borland due to CRT bugs)
9 && (($^O ne 'MSWin32' && $^O ne 'NetWare') || $Config{'cc'} =~ /^bcc/i))
10 {
11 print "1..0\n";
12 exit 0;
13 }
14 # make warnings fatal
15 $SIG{__WARN__} = sub { die @_ };
16}
17
18use strict;
19use IO::Handle;
20use IPC::Open3;
21#require 'open3.pl'; use subs 'open3';
22
23my $perl = $^X;
24
25sub ok {
26 my ($n, $result, $info) = @_;
27 if ($result) {
28 print "ok $n\n";
29 }
30 else {
31 print "not ok $n\n";
32 print "# $info\n" if $info;
33 }
34}
35
36sub cmd_line {
37 if ($^O eq 'MSWin32' || $^O eq 'NetWare') {
38 my $cmd = shift;
39 $cmd =~ tr/\r\n//d;
40 $cmd =~ s/"/\\"/g;
41 return qq/"$cmd"/;
42 }
43 else {
44 return $_[0];