Skip to content

Commit

Permalink
If Supply in on() is live, the resulting is also
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed May 5, 2014
1 parent 4cd39b9 commit f374d87
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/Supply.pm
Expand Up @@ -584,12 +584,14 @@ my class X::Supply::On::NoMore is Exception {
sub on(&setup) {
my class OnSupply does Supply {
has &!setup;
has Bool $!live = False;

submethod BUILD(:&!setup) { }

method !add_source(
$source, $lock, $index, :&more, :&done is copy, :&quit is copy
) {
$!live ||= True if $source.live;
&more // X::Supply::On::NoMore.new.throw;
&done //= { self.done };
&quit //= -> $ex { self.quit($ex) };
Expand Down Expand Up @@ -627,7 +629,7 @@ sub on(&setup) {
$source.tap( &tap_more, done => &tap_done, quit => &tap_quit );
}

method live { False }
method live { $!live }
method tap(|c) {
my @to_close;
my $sub = self.Supply::tap( |c, closing => {.close for @to_close});
Expand Down

0 comments on commit f374d87

Please sign in to comment.