Skip to content

Commit a5f6fcc

Browse files
xurshudyanXurshudyantaylorotwell
authored
[11.x] Add waitUntil method to Process (#53236)
* Add waitUntil method * Update InvokedProcess.php --------- Co-authored-by: Xurshudyan <[email protected]> Co-authored-by: Taylor Otwell <[email protected]>
1 parent 57a35ec commit a5f6fcc

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/Illuminate/Process/InvokedProcess.php

+19
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,23 @@ public function wait(?callable $output = null)
130130
throw new ProcessTimedOutException($e, new ProcessResult($this->process));
131131
}
132132
}
133+
134+
/**
135+
* Wait until the given callback returns true.
136+
*
137+
* @param callable|null $output
138+
* @return \Illuminate\Process\ProcessResult
139+
*
140+
* @throws \Illuminate\Process\Exceptions\ProcessTimedOutException
141+
*/
142+
public function waitUntil(?callable $output = null)
143+
{
144+
try {
145+
$this->process->waitUntil($output);
146+
147+
return new ProcessResult($this->process);
148+
} catch (SymfonyTimeoutException $e) {
149+
throw new ProcessTimedOutException($e, new ProcessResult($this->process));
150+
}
151+
}
133152
}

0 commit comments

Comments
 (0)