private function WindowsPipes::write in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/process/Pipes/WindowsPipes.php \Symfony\Component\Process\Pipes\WindowsPipes::write()
Writes input to stdin.
Parameters
bool $blocking:
bool $close:
1 call to WindowsPipes::write()
- WindowsPipes::readAndWrite in vendor/
symfony/ process/ Pipes/ WindowsPipes.php - Reads data in file handles and pipes.
File
- vendor/
symfony/ process/ Pipes/ WindowsPipes.php, line 193
Class
- WindowsPipes
- WindowsPipes implementation uses temporary files as handles.
Namespace
Symfony\Component\Process\PipesCode
private function write($blocking, $close) {
if (empty($this->pipes)) {
return;
}
$this
->unblock();
$r = null !== $this->input ? array(
'input' => $this->input,
) : null;
$w = isset($this->pipes[0]) ? array(
$this->pipes[0],
) : null;
$e = null;
// let's have a look if something changed in streams
if (false === ($n = @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1000000.0 : 0))) {
// if a system call has been interrupted, forget about it, let's try again
// otherwise, an error occurred, let's reset pipes
if (!$this
->hasSystemCallBeenInterrupted()) {
$this->pipes = array();
}
return;
}
// nothing has changed
if (0 === $n) {
return;
}
if (null !== $w && 0 < count($r)) {
$data = '';
while ($dataread = fread($r['input'], self::CHUNK_SIZE)) {
$data .= $dataread;
}
$this->inputBuffer .= $data;
if (false === $data || true === $close && feof($r['input']) && '' === $data) {
// no more data to read on input resource
// use an empty buffer in the next reads
$this->input = null;
}
}
if (null !== $w && 0 < count($w)) {
while (strlen($this->inputBuffer)) {
$written = fwrite($w[0], $this->inputBuffer, 2 << 18);
if ($written > 0) {
$this->inputBuffer = (string) substr($this->inputBuffer, $written);
}
else {
break;
}
}
}
// no input to read on resource, buffer is empty and stdin still open
if ('' === $this->inputBuffer && null === $this->input && isset($this->pipes[0])) {
fclose($this->pipes[0]);
unset($this->pipes[0]);
}
}