8000 Add some lines of doc for waitUntil() (Process) · symfony/symfony-docs@2814fea · GitHub
[go: up one dir, main page]

Skip to content

Commit 2814fea

Browse files
committed
Add some lines of doc for waitUntil() (Process)
1 parent 7f19b26 commit 2814fea

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

components/process.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,21 @@ in the output and its type::
233233
}
234234
});
235235

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`:
239+
240+
$process = new Process(array('/usr/bin/php', 'slow-starting-server.php'));
241+
$process->start();
242+
243+
// ... do other things
244+
245+
$process->waitUntil(function ($type, $output) {
246+
return $output === 'Ready. Waiting for commands...';
247+
});
248+
249+
// ... do things after the process is ready
250+
236251
Streaming to the Standard Input of a Process
237252
--------------------------------------------
238253

0 commit comments

Comments
 (0)
0