38 parent::__construct(
$input);
52 $nullstream = fopen(
'/dev/null',
'c');
63 array(
'file',
'/dev/tty',
'r'),
64 array(
'file',
'/dev/tty',
'w'),
65 array(
'file',
'/dev/tty',
'w'),
100 $read = $e = array();
109 $this->pipes = array();
115 foreach (
$r as $pipe) {
118 $read[$type = array_search($pipe, $this->pipes,
true)] =
'';
121 $data = fread($pipe, self::CHUNK_SIZE);
123 }
while (isset(
$data[0]));
125 if (!isset(
$read[$type][0])) {
129 if ($close && feof($pipe)) {
131 unset($this->pipes[$type]);
An exception for terminatinating execution or to throw for unit testing.
write()
Writes input to stdin.
close()
{Closes file handles and pipes.}
hasSystemCallBeenInterrupted()
Returns true if a system call has been interrupted.
unblock()
Unblocks streams.
UnixPipes implementation uses unix pipes as handles.
getFiles()
{Returns an array of filenames indexed by their related stream in case these pipes use temporary file...
haveReadSupport()
{Returns if pipes are able to read output.bool}
getDescriptors()
{Returns an array of descriptors for the use of proc_open.array}
__construct($ttyMode, $ptyMode, $input, $haveReadSupport)
areOpen()
{Returns if the current state has open file handles or pipes.bool}
readAndWrite($blocking, $close=false)
{Reads data in file handles and pipes.string[] An array of read data indexed by their fd}
Process is a thin wrapper around proc_* functions to easily start independent PHP processes.
static isPtySupported()
Returns whether PTY is supported on the current operating system.