[Process] fixed usage of constants in closure
This commit is contained in:
parent
7581c3b221
commit
1bef14a02a
@ -94,9 +94,11 @@ class Process
|
|||||||
$this->stdout = '';
|
$this->stdout = '';
|
||||||
$this->stderr = '';
|
$this->stderr = '';
|
||||||
$that = $this;
|
$that = $this;
|
||||||
$callback = function ($type, $data) use ($that, $callback)
|
$out = self::OUT;
|
||||||
|
$err = self::ERR;
|
||||||
|
$callback = function ($type, $data) use ($that, $callback, $out, $err)
|
||||||
{
|
{
|
||||||
if (self::OUT == $type) {
|
if ($out == $type) {
|
||||||
$that->addOutput($data);
|
$that->addOutput($data);
|
||||||
} else {
|
} else {
|
||||||
$that->addErrorOutput($data);
|
$that->addErrorOutput($data);
|
||||||
@ -159,7 +161,7 @@ class Process
|
|||||||
$type = array_search($pipe, $pipes);
|
$type = array_search($pipe, $pipes);
|
||||||
$data = fread($pipe, 8192);
|
$data = fread($pipe, 8192);
|
||||||
if (strlen($data) > 0) {
|
if (strlen($data) > 0) {
|
||||||
call_user_func($callback, $type == 1 ? self::OUT : self::ERR, $data);
|
call_user_func($callback, $type == 1 ? $out : $err, $data);
|
||||||
}
|
}
|
||||||
if (false === $data || feof($pipe)) {
|
if (false === $data || feof($pipe)) {
|
||||||
fclose($pipe);
|
fclose($pipe);
|
||||||
|
Reference in New Issue
Block a user