| Defined | src/filesystem/linesofalarge/LinesOfALargeExecFuture.php:26 |
|---|---|
| Group | Filesystem |
| Extends | LinesOfALarge |
Read the output stream of an ExecFuture one line at a time. This abstraction allows you to process large inputs without holding them in memory. If you know your inputs fit in memory, it is generally more efficient (and certainly simpler) to read the entire input and explode() it. For more information, see LinesOfALarge. See also LinesOfALargeFile for a similar abstraction that works on files.
$future = new ExecFuture('hg log ...'); foreach (new LinesOfALargeExecFuture($future) as $line) { // ... }
If the subprocess exits with an error, a CommandException will be thrown.
On destruction, this class terminates the subprocess if it has not already exited.
| parameters | ExecFuture | $future | Future to wrap. |
| return | this |
To construct, pass an ExecFuture.
| return | void |
On destruction, we terminate the subprocess if it hasn't exited already.
| return | string | Bytes read from stdout. |
Read more data from the subprocess.
| return | void |
The PHP foreach() construct calls rewind() once, so we allow the first rewind(), without effect. Subsequent rewinds mean misuse.