elFinder\elFinderVolumeDriver::procExec PHP Метод

procExec() защищенный Метод

Execute shell command
Автор: Alexey Sukhotin
protected procExec ( string $command, array &$output = null, array &$return_var, array &$error_output = null ) : integer
$command string command line
$output array stdout strings
$return_var array process exit code
$error_output array stderr strings
Результат integer exit code
    protected function procExec($command, array &$output = null, &$return_var = -1, array &$error_output = null)
    {
        $descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
        $process = proc_open($command, $descriptorspec, $pipes, null, null);
        if (is_resource($process)) {
            fclose($pipes[0]);
            $tmpout = '';
            $tmperr = '';
            $output = stream_get_contents($pipes[1]);
            $error_output = stream_get_contents($pipes[2]);
            fclose($pipes[1]);
            fclose($pipes[2]);
            $return_var = proc_close($process);
        }
        return $return_var;
    }