-
-
Save tokuhirom/522571 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl -w | |
use strict; | |
use IPC::Open3; | |
use Symbol qw(gensym); | |
my($r, $w, $e) = (gensym, gensym, gensym); | |
my $pid = open3($r, $w, $e, "perl", "-e", | |
'print $_ qq{x\n} x (1024 * 1024) for \*STDOUT, \*STDERR'); | |
#close $w; # => SIGPIPE | |
#close $e; # => SIGPIPE | |
warn "waitpid $pid ...\n"; | |
waitpid $pid, 0; | |
warn $?, "\n"; | |
__END__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl -w | |
use strict; | |
use IPC::Open3; | |
use Symbol qw(gensym); | |
my($wtr, $rdr, $err) = (gensym, gensym, gensym); | |
my $pid = open3($wtr, $rdr, 0, "perl", "-e", | |
'print $_ qq{x\n} x (1024 * 1024) for \*STDOUT, \*STDERR'); | |
close $wtr; | |
() = <$rdr>; | |
warn "waitpid $pid ...\n"; | |
waitpid $pid, 0; | |
warn $?, "\n"; | |
__END__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment