File tree 1 file changed +16
-0
lines changed
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::
69
69
}
70
70
}
71
71
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
+
72
88
The ``mustRun() `` method is identical to ``run() ``, except that it will throw
73
89
a :class: `Symfony\\ Component\\ Process\\ Exception\\ ProcessFailedException `
74
90
if the process couldn't be executed successfully (i.e. the process exited
You can’t perform that action at this time.
0 commit comments