Skip Menu |
Report information
Id: 126998
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: vytdau [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: Use of Proc with IO::Pipe is counter-intuitive
From: Vytautas D <vytdau [...] gmail.com>
Date: Wed, 23 Dec 2015 11:05:24 +0000
To: rakudobug [...] perl.org
Download (untitled) / with headers
text/plain 691b
Following script throws error ( "Aborted (core dumped)" ) when $id == 1007. This is because $p.err is really never closed. however, what I find intriguing is if I remove "my $output = $p.err.slurp-rest;" line it works fine. None the less, error message should be improved. use v6; my $id = 0; recursion(); sub recursion() { say ++$id; my $p = run('false', :out, :err ); my $output = $p.err.slurp-rest; try { $p.out.close; $p.err.close; CATCH { default {} } } if ($id < 1010) { recursion(); } } $ perl6 --version This is Rakudo version 2015.11-708-g76c447b built on MoarVM version 2015.11-113-gbd56e2e implementing Perl 6.b.
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 991b
On Wed, 23 Dec 2015 03:05:41 -0800, vytdau@gmail.com wrote: Show quoted text
> Following script throws error ( "Aborted (core dumped)" ) when $id == > 1007. This is because $p.err is really never closed. however, what I > find intriguing is if I remove "my $output = $p.err.slurp-rest;" line > it works fine. None the less, error message should be improved. > > use v6; > > my $id = 0; > recursion(); > > sub recursion() > { > say ++$id; > > my $p = run('false', :out, :err ); > my $output = $p.err.slurp-rest; > > try { > $p.out.close; > $p.err.close; > CATCH { default {} } > } > > if ($id < 1010) { > recursion(); > } > } > > $ perl6 --version > This is Rakudo version 2015.11-708-g76c447b built on MoarVM version > 2015.11-113-gbd56e2e implementing Perl 6.b.
To note: the crash is due to exhausting open file descriptors. Sticking this at the start of the script makes it crash when $id is 807 my @fhs = ^200 .map: *.IO.open: :w;


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org