Creates the descriptors needed by the proc_open.
array
private function getDescriptors() {
//Fix for PHP bug #51800: reading from STDOUT pipe hangs forever on Windows if the output is too big.
//Workaround for this problem is to use temporary files instead of pipes on Windows platform.
//@see https://bugs.php.net/bug.php?id=51800
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$this->fileHandles = array(
self::STDOUT => tmpfile(),
);
if (false === $this->fileHandles[self::STDOUT]) {
throw new RuntimeException('A temporary file could not be opened to write the process output to, verify that your TEMP environment variable is writable');
}
$this->readBytes = array(
self::STDOUT => 0,
);
return array(
array(
'pipe',
'r',
),
$this->fileHandles[self::STDOUT],
array(
'pipe',
'w',
),
);
}
if ($this->tty) {
$descriptors = array(
array(
'file',
'/dev/tty',
'r',
),
array(
'file',
'/dev/tty',
'w',
),
array(
'file',
'/dev/tty',
'w',
),
);
}
else {
$descriptors = array(
array(
'pipe',
'r',
),
// stdin
array(
'pipe',
'w',
),
// stdout
array(
'pipe',
'w',
),
);
}
if ($this->enhanceSigchildCompatibility && $this
->isSigchildEnabled()) {
// last exit code is output on the fourth pipe and caught to work around --enable-sigchild
$descriptors = array_merge($descriptors, array(
array(
'pipe',
'w',
),
));
$this->commandline = '(' . $this->commandline . ') 3>/dev/null; code=$?; echo $code >&3; exit $code';
}
return $descriptors;
}