On Tue, 16 Sep 2014 13:47:14 -0700, LeonT wrote:
> On Sun Sep 07 15:36:08 2014, LeonT wrote:
> > As per subject, Proc::Async's streams may call &done() before calling
> > their &tap/&act for the last time. Take for example this code:
> >
> > my $num = @*ARGS.shift // 3;
> >
> > my @procs = (1..$num).map( -> $count {
> > my $proc = Proc::Async.new(:path('echo'), :args(<Hello World>));
> > my $input = $proc.stdout_chars();
> > $input.act(-> $input { say "$count: " ~ $input.chomp }, :done({ say
> > "$count is done" }));
> > { :$proc, :$input, :done($proc.start()) };
> > });
> >
> > await @procs.map(*.<done>);
> >
> > It will give a non-deterministic output, that will typically look
> > something like this:
> >
> > 1 is done
> > 1 is done
> > 1: Hello World
> > 2: Hello World
> > 2 is done
> > 2 is done
> > 3 is done
> > 3 is done
> > 3: Hello World
> >
> > (the double done's are reported as #122714)
> >
> > It sometimes also includes errors such as:
> >
> > Unhandled exception in code scheduled on thread 140254841403136
> >
> > or
> >
> > This representation (Null) does not support elems
> >
> > Not sure what's going on exactly, but this is limiting the use of the
> > output Supplies greatly.
>
> The attached patch should fix this, but I'm not sure how to test this well.
>
It seems in the meantime an equivalent patch has been applied to address this
same issue:
https://github.com/rakudo/rakudo/blob/nom/src/core/Proc/Async.pm#L258
And I've not seen anything like this issue show up in a long time, so I think
this can be considered resolved now.
/jnthn