File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,22 @@ for new output before going to the next iteration::
6969 }
7070 }
7171
72+ .. tip ::
73+
74+ The Process component internally uses a PHP iterator to get the output while
75+ it is generated. That iterator is exposed via the ``getIterator() `` method
76+ to allow customizing its behavior::
77+
78+ $process = new Process('ls -lsa');
79+ $process->start();
80+ $iterator = $process->getIterator($process::ITER_SKIP_ERR | $process::ITER_KEEP_OUTPUT);
81+ foreach ($iterator as $data) {
82+ echo $data."\n";
83+ }
84+
85+ .. versionadded :: 3.2
86+ The ``getIterator() `` method was introduced in Symfony 3.2.
87+
7288The ``mustRun() `` method is identical to ``run() ``, except that it will throw
7389a :class: `Symfony\\ Component\\ Process\\ Exception\\ ProcessFailedException `
7490if the process couldn't be executed successfully (i.e. the process exited
You can’t perform that action at this time.
0 commit comments