Skip to content

Commit

Permalink
watch the streams before reading from them
Browse files Browse the repository at this point in the history
  • Loading branch information
Baptouuuu committed Nov 5, 2023
1 parent 10a81de commit 85e65bf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [Unreleased]

### Added

- Watch the streams before reading from them (allows for an easy integration in `Fiber`s)

## 7.2.0- 2023-11-01

### Added
Expand Down
2 changes: 2 additions & 0 deletions src/File/Content/AtPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public function lines(): Sequence
$io = $this->io->wrap($stream);

yield $io
->watch()
->lines()
->lazy()
->sequence();
Expand Down Expand Up @@ -122,6 +123,7 @@ public function chunks(): Sequence
$io = $this->io->wrap($stream);

yield $io
->watch()
->chunks(8192)
->lazy()
->sequence();
Expand Down
2 changes: 2 additions & 0 deletions src/File/Content/IO.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public function lines(): Sequence
/** @psalm-suppress ImpureMethodCall */
return $this
->io
->watch()
->lines()
->lazy()
->rewindable()
Expand Down Expand Up @@ -88,6 +89,7 @@ public function chunks(): Sequence
/** @psalm-suppress ImpureMethodCall */
return $this
->io
->watch()
->chunks(8192)
->lazy()
->rewindable()
Expand Down
2 changes: 2 additions & 0 deletions src/File/Content/OneShot.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function lines(): Sequence

yield $this
->io
->watch()
->lines()
->lazy()
->sequence();
Expand Down Expand Up @@ -95,6 +96,7 @@ public function chunks(): Sequence

yield $this
->io
->watch()
->chunks(8192)
->lazy()
->sequence();
Expand Down

0 comments on commit 85e65bf

Please sign in to comment.