Mike42\Escpos\PrintConnectors\WindowsPrintConnector::runCommand PHP Метод

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

Run a command, pass it data, and retrieve its return value, standard output, and standard error.
protected runCommand ( string $command, string &$outputStr, string &$errorStr, string $inputStr = null ) : number
$command string the command to run.
$outputStr string variable to fill with standard output.
$errorStr string variable to fill with standard error.
$inputStr string text to pass to the command's standard input (optional).
Результат number
    protected function runCommand($command, &$outputStr, &$errorStr, $inputStr = null)
    {
        $descriptors = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
        $process = proc_open($command, $descriptors, $fd);
        if (is_resource($process)) {
            /* Write to input */
            if ($inputStr !== null) {
                fwrite($fd[0], $inputStr);
            }
            fclose($fd[0]);
            /* Read stdout */
            $outputStr = stream_get_contents($fd[1]);
            fclose($fd[1]);
            /* Read stderr */
            $errorStr = stream_get_contents($fd[2]);
            fclose($fd[2]);
            /* Finish up */
            $retval = proc_close($process);
            return $retval;
        } else {
            /* Method calling this should notice a non-zero exit and print an error */
            return -1;
        }
    }