3 # $RCSfile: pipe.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:31 $
8 require Config; import Config;
9 unless ($Config{'d_fork'}) {
18 open(PIPE, "|-") || (exec 'tr', 'YX', 'ko');
23 if (open(PIPE, "-|")) {
30 print STDOUT "not ok 3\n";
31 exec 'echo', 'not ok 4';
34 pipe(READER,WRITER) || die "Can't open pipe";
45 die "Couldn't fork" unless defined $pid;
47 print WRITER "not ok 5\n";
48 open(STDOUT,">&WRITER") || die "Can't dup WRITER to STDOUT";
50 exec 'echo', 'not ok 6';
54 pipe(READER,WRITER) || die "Can't open pipe";
57 $SIG{'PIPE'} = 'broken_pipe';
63 print WRITER "not ok 7\n";
68 # VMS doesn't like spawning subprocesses that are still connected to
69 # STDOUT. Someone should modify tests #9 and #10 to work with VMS.
77 if ($Config{d_sfio}) {
78 # Sfio doesn't report failure when closing a broken pipe
79 # that has pending output. Go figure.
83 local $SIG{PIPE} = 'IGNORE';
84 open NIL, '|true' or die "open failed: $!";
86 print NIL 'foo' or die "print failed: $!";
95 # check that errno gets forced to 0 if the piped program exited non-zero
96 open NIL, '|exit 23;' or die "fork failed: $!";
99 print "not ok 10\n# successful close\n";
102 print "not ok 10\n# errno $!\n";
105 print "not ok 10\n# status 0\n";