PhpBrew\PatchUtils::applyStdin PHP Method

applyStdin() public static method

public static applyStdin ( $diff, &$output, $level )
    public static function applyStdin($diff, &$output, $level = 0)
    {
        $desc = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'));
        $process = proc_open('patch', $desc, $pipes);
        if (!is_resource($process)) {
            throw new RuntimeException("Can't open process");
        }
        fwrite($pipes[0], $diff);
        fclose($pipes[0]);
        $output = stream_get_contents($pipes[1]);
        fclose($pipes[1]);
        return proc_close($process);
    }