[Process] Turn getIterator() args to flags & add ITER_SKIP_OUT/ERR modes#18513
[Process] Turn getIterator() args to flags & add ITER_SKIP_OUT/ERR modes#18513nicolas-grekas merged 1 commit intosymfony:masterfrom
Conversation
c717d73 to
8399b79
Compare
| * @return \Generator | ||
| */ | ||
| public function getIterator($blocking = true, $clearOutput = true) | ||
| public function getIterator($flags = 0) |
There was a problem hiding this comment.
One of the best advantage of this is to be able to pipe a process in another process.
We could use the same behavior as unix | and forward only stdout (use self:: ITER_SKIP_ERR) by default).
WDYT?
There was a problem hiding this comment.
👍 good catch, I added a test case chaining two processes, works like a charm!
8399b79 to
04e8f0a
Compare
04e8f0a to
428f12e
Compare
|
|
||
| public function testChainedProcesses() | ||
| { | ||
| $p1 = new Process(self::$phpBin.' -r '.escapeshellarg('fwrite(STDERR, 123); fwrite(STDOUT, 456);')); |
There was a problem hiding this comment.
We can have only one getProces per test case. And there is not need to configure differently the process for sigchild. So no need.
There was a problem hiding this comment.
Was not aware of getProcess being usable only once per test. so fine with me
|
👍 for this (and should be merged in 3.1 to avoid having to maintain BC for the boolean-based signature as it is a new method in 3.1 anyway) Status: reviewed |
|
👍 |
…SKIP_OUT/ERR modes (nicolas-grekas) This PR was merged into the 3.1-dev branch. Discussion ---------- [Process] Turn getIterator() args to flags & add ITER_SKIP_OUT/ERR modes | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #8454 | License | MIT | Doc PR | - Targeted at 3.1 Commits ------- 428f12e [Process] Turn getIterator() args to flags & add ITER_SKIP_OUT/ERR modes
Targeted at 3.1