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} || $^O eq machten) {
78 # Sfio doesn't report failure when closing a broken pipe
79 # that has pending output. Go figure. MachTen doesn't either,
80 # but won't write to broken pipes, so nothing's pending at close.
84 local $SIG{PIPE} = 'IGNORE';
85 open NIL, '|true' or die "open failed: $!";
87 print NIL 'foo' or die "print failed: $!";
96 # check that errno gets forced to 0 if the piped program exited non-zero
97 open NIL, '|exit 23;' or die "fork failed: $!";
100 print "not ok 10\n# successful close\n";
103 print "not ok 10\n# errno $!\n";
106 print "not ok 10\n# status 0\n";