Skip to content

Instantly share code, notes, and snippets.

@skids
Created November 24, 2015 02:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skids/e8149189ac5c24ae493e to your computer and use it in GitHub Desktop.
Save skids/e8149189ac5c24ae493e to your computer and use it in GitHub Desktop.
Input Supply.Channel problems
So, this would seem to be the way to make a Supply from an IO::Pipe useful for waiting for the
pipe to close and then doing something with the pipe output. But it does not work reliably.
Similar schemes working directly with the Supply also have issues, since any state accumulating
the output in tap callbacks may not be complete inside a :done callback. Note that sometimes
(maybe when certain parts of the guts schedule on the same thread) it pretty much works -- I killed
statistically improbable runs with ^C below. Also note failures on run 8 and run 32 are popular.
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 6 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 8 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 3 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 5 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
^C
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 32 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 201 times
in block at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 8 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 8 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
^C
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
^C
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
^C
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 32 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 8 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 145 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
^C
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 77 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 32 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 32 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 8 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 32 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 1 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 8 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 32 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 8 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 8 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 8 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
after 8 times
in block <unit> at -e:1
$ perl6 -e 'sub f { my $cmd = Proc::Async.new(:path<ls>); my $c = $cmd.stdout.Channel; $cmd.start; $'
^C
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment