54 $tmpDir = sys_get_temp_dir();
56 set_error_handler(
function ($type, $msg) use (&
$error) {
$error = $msg; });
58 foreach (
$pipes as $pipe => $name) {
59 $file = sprintf(
'%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
64 if (!
$h &&
false === strpos(
$error,
'File exists')) {
65 restore_error_handler();
66 throw new RuntimeException(sprintf(
'A temporary file could not be opened to write the process output: %s',
$error));
68 if (!
$h || !$this->fileHandles[$pipe] = fopen(
$file,
'rb')) {
71 if (isset($this->
files[$pipe])) {
72 unlink($this->
files[$pipe]);
78 restore_error_handler();
81 parent::__construct(
$input);
96 $nullstream = fopen(
'NUL',
'c');
110 array(
'file',
'NUL',
'w'),
111 array(
'file',
'NUL',
'w'),
135 } elseif ($this->fileHandles) {
139 foreach ($this->fileHandles as $type => $fileHandle) {
140 $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
142 if (isset(
$data[0])) {
143 $this->readBytes[$type] += strlen(
$data);
148 unset($this->fileHandles[$type]);
177 foreach ($this->fileHandles as $handle) {
180 $this->fileHandles =
array();
189 if (file_exists($filename)) {
getDescriptors()
{Returns an array of descriptors for the use of proc_open.array}
areOpen()
{Returns if the current state has open file handles or pipes.bool}
write()
Writes input to stdin.
getFiles()
{Returns an array of filenames indexed by their related stream in case these pipes use temporary file...
removeFiles()
Removes temporary files.
close()
{Closes file handles and pipes.}
Create styles array
The data for the language used.
__construct($input, $haveReadSupport)
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
WindowsPipes implementation uses temporary files as handles.
haveReadSupport()
{Returns if pipes are able to read output.bool}
unblock()
Unblocks streams.
readAndWrite($blocking, $close=false)
{Reads data in file handles and pipes.Whether to use blocking calls or not Whether to close pipes if ...