Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nette/utils
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cd9170e2f9cc1d94c72c7656ee76f01b19c2bda3
Choose a base ref
..
head repository: nette/utils
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2b48b24abf3b59c3699ca99e144deb5c0020208f
Choose a head ref
Showing with 5 additions and 5 deletions.
  1. +5 −3 src/Utils/Process.php
  2. +0 −2 tests/Utils/Process.basic.phpt
8 changes: 5 additions & 3 deletions src/Utils/Process.php
Original file line number Diff line number Diff line change
@@ -156,12 +156,11 @@ public function isRunning(): bool
public function wait(?\Closure $callback = null): void
{
while ($this->isRunning()) {
if ($this->enforceTimeout()) {
usleep(self::PollInterval);
}
$this->enforceTimeout();
if ($callback) {
$this->dispatchCallback($callback);
}
usleep(self::PollInterval);
}

if ($callback) {
@@ -274,6 +273,9 @@ private function consumeBuffer(int $id): string
{
if (!isset($this->outputBuffers[$id])) {
throw new \LogicException('Cannot read output: output capturing was not enabled');
} elseif ($this->isRunning()) {
$this->enforceTimeout();
$this->readFromPipe($id);
}
$res = substr($this->outputBuffers[$id], $this->outputBufferOffsets[$id]);
$this->outputBufferOffsets[$id] = strlen($this->outputBuffers[$id]);
2 changes: 0 additions & 2 deletions tests/Utils/Process.basic.phpt
Original file line number Diff line number Diff line change
@@ -11,8 +11,6 @@ use Tester\Assert;
require __DIR__ . '/../bootstrap.php';


dump(PHP_BINARY);

// Process execution - success

test('run executable successfully', function () {