diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-01-27 19:43:35 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-01-27 19:43:35 +0000 |
commit | 030866aa8d0911636ef2210b710f544fd2c85c8e (patch) | |
tree | 78db3f262afc04ec35b86c1618d43068a5f7851c /t | |
parent | b181b6fb157975572d5e0c5c46c1594e317a45ba (diff) | |
download | perl-030866aa8d0911636ef2210b710f544fd2c85c8e.tar.gz |
document unimplemented status of forking pipe open() on windows
p4raw-id: //depot/perl@4914
Diffstat (limited to 't')
-rwxr-xr-x | t/op/fork.t | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/t/op/fork.t b/t/op/fork.t index 11efa79d17..f3d74f978f 100755 --- a/t/op/fork.t +++ b/t/op/fork.t @@ -320,3 +320,50 @@ BEGIN { #print "outer\n" EXPECT inner +######## +sub pipe_to_fork ($$) { + my $parent = shift; + my $child = shift; + pipe($child, $parent) or die; + my $pid = fork(); + die "fork() failed: $!" unless defined $pid; + close($pid ? $child : $parent); + $pid; +} + +if (pipe_to_fork('PARENT','CHILD')) { + # parent + print PARENT "pipe_to_fork\n"; + close PARENT; +} +else { + # child + while (<CHILD>) { print; } + close CHILD; + exit; +} + +sub pipe_from_fork ($$) { + my $parent = shift; + my $child = shift; + pipe($parent, $child) or die; + my $pid = fork(); + die "fork() failed: $!" unless defined $pid; + close($pid ? $child : $parent); + $pid; +} + +if (pipe_from_fork('PARENT','CHILD')) { + # parent + while (<PARENT>) { print; } + close PARENT; +} +else { + # child + print CHILD "pipe_from_fork\n"; + close CHILD; + exit; +} +EXPECT +pipe_from_fork +pipe_to_fork |