Skip to content

Commit

Permalink
[11.x] Add waitUntil method to Process (#53236)
Browse files Browse the repository at this point in the history
* Add waitUntil method

* Update InvokedProcess.php

---------

Co-authored-by: Xurshudyan <v.khurshudyan@aico.swiss>
Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
3 people authored Oct 21, 2024
1 parent 57a35ec commit a5f6fcc
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Illuminate/Process/InvokedProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,23 @@ public function wait(?callable $output = null)
throw new ProcessTimedOutException($e, new ProcessResult($this->process));
}
}

/**
* Wait until the given callback returns true.
*
* @param callable|null $output
* @return \Illuminate\Process\ProcessResult
*
* @throws \Illuminate\Process\Exceptions\ProcessTimedOutException
*/
public function waitUntil(?callable $output = null)
{
try {
$this->process->waitUntil($output);

return new ProcessResult($this->process);
} catch (SymfonyTimeoutException $e) {
throw new ProcessTimedOutException($e, new ProcessResult($this->process));
}
}
}

0 comments on commit a5f6fcc

Please sign in to comment.