# New Ticket Created by  Leon Timmermans 
# Please include the string:  [perl #122722]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=122722 >


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.

Leon

Reply via email to