Skip to content

Commit

Permalink
0.0.31
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Oct 6, 2022
1 parent 4cebe0b commit ee91263
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
3 changes: 3 additions & 0 deletions Changes
Expand Up @@ -2,6 +2,9 @@ Revision history for rak

{{$NEXT}}

0.0.31 2022-10-06T14:33:17+02:00
- Make sure that :find doesn't eagerize either

0.0.30 2022-10-02T17:49:27+02:00
- Make sure reading from STDIN does not eagerize to allow
tail -f sources to work
Expand Down
2 changes: 1 addition & 1 deletion META6.json
Expand Up @@ -29,5 +29,5 @@
],
"test-depends": [
],
"version": "0.0.30"
"version": "0.0.31"
}
28 changes: 15 additions & 13 deletions lib/rak.rakumod
Expand Up @@ -833,18 +833,19 @@ multi sub rak(&pattern, %n) {
}

# Some settings we always need
my $batch := %n<batch>:delete;
my $degree := %n<degree>:delete;
my $enc := %n<encoding>:delete // 'utf8-c8';
my $reading-from-stdin := !($*IN.t);
my $batch := %n<batch>:delete;
my $degree := %n<degree>:delete;
my $enc := %n<encoding>:delete // 'utf8-c8';
my $eagerSlip := True;

# Step 1: sources sequence
my $sources-seq = do if %n<sources>:delete -> $sources {
$sources
}
elsif $reading-from-stdin {
my $sources-seq = do if !($*IN.t) {
$eagerSlip := False;
$*IN
}
elsif %n<sources>:delete -> $sources {
$sources
}
elsif %n<paths>:exists && %n<paths> eq '-' {
%n<paths>:delete;
warn-if-human-on-stdin;
Expand Down Expand Up @@ -933,6 +934,7 @@ multi sub rak(&pattern, %n) {
!! -> $source { $produce-many($source) }
}
elsif %n<find>:delete {
$eagerSlip := False;
my $seq := $sources-seq<>;
$sources-seq = ("<find>",);
my int $line-number;
Expand Down Expand Up @@ -1201,19 +1203,19 @@ multi sub rak(&pattern, %n) {
}
}

# reading from STDIN should not eagerize
elsif $reading-from-stdin {
# Want each file to eager Slip its items
elsif $eagerSlip {
$sources-seq.map: -> $*SOURCE {
++$nr-sources;
Pair.new: $*SOURCE, producer($*SOURCE).map: runner
Pair.new: $*SOURCE, eagerSlip producer($*SOURCE).map: runner
}
}

# Nothing special to do for each source
# Each file (probably only one) will run over items lazily
else {
$sources-seq.map: -> $*SOURCE {
++$nr-sources;
Pair.new: $*SOURCE, eagerSlip producer($*SOURCE).map: runner
Pair.new: $*SOURCE, producer($*SOURCE).map: runner
}
}

Expand Down

0 comments on commit ee91263

Please sign in to comment.