8000 [Process] don't populate internal buffer if user closure is supplied by avindra · Pull Request #17393 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Process] don't populate internal buffer if user closure is supplied #17393

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions src/Symfony/Component/Process/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -1211,14 +1211,14 @@ protected function buildCallback($callback)
{
$out = self::OUT;
$callback = function ($type, $data) use ($callback, $out) {
if ($out == $type) {
$this->addOutput($data);
} else {
$this->addErrorOutput($data);
}

if (null !== $callback) {
call_user_func($callback, $type, $data);
} else {
if ($out == $type) {
$this->addOutput($data);
} else {
$this->addErrorOutput($data);
}
}
};

Expand Down
6 changes: 3 additions & 3 deletions src/Symfony/Component/Process/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (!$process->isSuccessful()) {
print $process->getOutput();
```

You can think that this is easy to achieve with plain PHP but it's not especially
You may think that this is easy to achieve with plain PHP but it's not especially
if you want to take care of the subtle differences between the different platforms.

You can simplify the code by using `mustRun()` instead of `run()`, which will
Expand All @@ -35,9 +35,9 @@ $process->mustRun();
print $process->getOutput();
```

And if you want to be able to get some feedback in real-time, just pass an
If you want to be able to get some feedback in real-time, just pass an
anonymous function to the ``run()`` method and you will get the output buffer
as it becomes available:
as it becomes available instead:

```php
use Symfony\Component\Process\Process;
Expand Down
0