File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -233,21 +233,26 @@ in the output and its type::
233
233
}
234
234
});
235
235
236
- You may want to wait for a specific output of the process you started
237
- asynchronously, for this use case you may use the method
238
- :method: `Symfony\\ Component\\ Process\\ Process::waitUntil `:
236
+ Instead of waiting until the process has finished, you can use the
237
+ :method: `Symfony\\ Component\\ Process\\ Process::waitUntil ` method to keep or stop
238
+ waiting based on some PHP logic. The following example starts a long running
239
+ process and checks its output to wait until its fully initialized::
239
240
240
241
$process = new Process(array('/usr/bin/php', 'slow-starting-server.php'));
241
242
$process->start();
242
243
243
244
// ... do other things
244
245
246
+ // waits until the given anonymous function returns true
245
247
$process->waitUntil(function ($type, $output) {
246
248
return $output === 'Ready. Waiting for commands...';
247
249
});
248
250
249
251
// ... do things after the process is ready
250
252
253
+ .. versionadded :: 4.2
254
+ The ``waitUntil() `` method was introduced in Symfony 4.2.
255
+
251
256
Streaming to the Standard Input of a Process
252
257
--------------------------------------------
253
258
You can’t perform that action at this time.
0 commit comments