protected function Process::buildCallback in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/process/Process.php \Symfony\Component\Process\Process::buildCallback()
Builds up the callback used by wait().
The callbacks adds all occurred output to the specific buffer and calls the user callback (if present) with the received output.
Parameters
callable|null $callback The user defined PHP callback:
Return value
\Closure A PHP closure
2 calls to Process::buildCallback()
- Process::start in vendor/
symfony/ process/ Process.php - Starts the process and returns after writing the input to STDIN.
- Process::wait in vendor/
symfony/ process/ Process.php - Waits for the process to terminate.
File
- vendor/
symfony/ process/ Process.php, line 1275
Class
- Process
- Process is a thin wrapper around proc_* functions to easily start independent PHP processes.
Namespace
Symfony\Component\ProcessCode
protected function buildCallback($callback) {
$that = $this;
$out = self::OUT;
$callback = function ($type, $data) use ($that, $callback, $out) {
if ($out == $type) {
$that
->addOutput($data);
}
else {
$that
->addErrorOutput($data);
}
if (null !== $callback) {
call_user_func($callback, $type, $data);
}
};
return $callback;
}