Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of Proc with IO::Pipe is counter-intuitive #4906

Open
p6rt opened this issue Dec 23, 2015 · 3 comments
Open

Use of Proc with IO::Pipe is counter-intuitive #4906

p6rt opened this issue Dec 23, 2015 · 3 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 23, 2015

Migrated from rt.perl.org#126998 (status was 'open')

Searchable as RT126998$

@p6rt
Copy link
Author

p6rt commented Dec 23, 2015

From vytdau@gmail.com

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.

@p6rt
Copy link
Author

p6rt commented May 4, 2017

From @zoffixznet

On Wed, 23 Dec 2015 03​:05​:41 -0800, vytdau@​gmail.com wrote​:

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;

@p6rt
Copy link
Author

p6rt commented May 4, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt p6rt added the IO label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant