private function Lessjs::proc_open in Less CSS Preprocessor 7.3
Same name and namespace in other branches
- 8 classes/class.lessjs.inc \Lessjs::proc_open()
- 7.4 classes/class.lessjs.inc \Lessjs::proc_open()
3 calls to Lessjs::proc_open()
- Lessjs::compile in ./
class.lessjs.inc - Executes compilation of LESS input.
- Lessjs::depends in ./
class.lessjs.inc - Returns list of files that input file depends on.
- Lessjs::version in ./
class.lessjs.inc - Returns the version string from command line less.js.
File
- ./
class.lessjs.inc, line 198 - Contains 'lessjs' class; an abstraction layer for command line less.js.
Class
- Lessjs
- 'lessjs' class.
Code
private function proc_open($command_arguments = array(), $stdin = NULL) {
$output_data = NULL;
$command = implode(' ', array_merge(array(
self::$base_command,
), $command_arguments));
// Handles for data exchange.
$pipes = array(
0 => NULL,
// STDIN
1 => NULL,
// STDOUT
2 => NULL,
);
// Sets permissions on $pipes.
$descriptors = array(
0 => array(
'pipe',
'r',
),
// STDIN
1 => array(
'pipe',
'w',
),
// STDOUT
2 => array(
'pipe',
'w',
),
);
$process = proc_open($command, $descriptors, $pipes);
if (is_resource($process)) {
// STDIN not currently used in LESS module.
if ($this->input_file === '-' && isset($stdin)) {
fwrite($pipes[0], $stdin);
}
fclose($pipes[0]);
// fclose() on STDIN executes $command, if program is expecting input from STDIN.
$output_data = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$this->error = stream_get_contents($pipes[2]);
fclose($pipes[2]);
proc_close($process);
}
return $output_data;
}