protected function LessAutoprefixer::proc_open in Less CSS Preprocessor 8
Same name and namespace in other branches
- 7.4 classes/class.lessautoprefixer.inc \LessAutoprefixer::proc_open()
1 call to LessAutoprefixer::proc_open()
- LessAutoprefixer::compile in classes/class.lessautoprefixer.inc
- Executes auto-prefixing of LESS output file.
File
- classes/class.lessautoprefixer.inc, line 108
- Contains 'LessAutoprefixer' class; an abstraction layer for command line Autoprefixer.
Class
- LessAutoprefixer
- 'Autoprefixer' class.
Code
protected function proc_open($command_arguments = array()) {
$output_data = NULL;
$command = implode(' ', array_merge(array(
self::BASE_COMMAND,
), $command_arguments));
$pipes = array(
0 => NULL,
1 => NULL,
2 => NULL,
);
$descriptors = array(
0 => array(
'pipe',
'r',
),
1 => array(
'pipe',
'w',
),
2 => array(
'pipe',
'w',
),
);
try {
$process = proc_open($command, $descriptors, $pipes);
if (is_resource($process)) {
fclose($pipes[0]);
$output_data = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$error = stream_get_contents($pipes[2]);
fclose($pipes[2]);
if (!empty($error)) {
throw new Exception($error);
}
proc_close($process);
}
} catch (Exception $e) {
throw $e;
}
return $output_data;
}