Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions components/process.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,24 @@ are done doing other stuff::
$process->start();

// ... do other things

$process->wait();

// ... do things after the process has finished

.. note::

The :method:`Symfony\\Component\\Process\\Process::wait` method is blocking,
which means that your code will halt at this line until the external
process is completed.

:method:`Symfony\\Component\\Process\\Process::wait` takes one optional argument:
a callback that is called repeatedly whilst the process is still running, passing
in the output and its type::

$process = new Process('ls -lsa');
$process->start();

$process->wait(function ($type, $buffer) {
if (Process::ERR === $type) {
echo 'ERR > '.$buffer;
Expand All @@ -141,12 +158,6 @@ are done doing other stuff::
}
});

.. note::

The :method:`Symfony\\Component\\Process\\Process::wait` method is blocking,
which means that your code will halt at this line until the external
process is completed.

Streaming to the Standard Input of a Process
--------------------------------------------

Expand Down