StdioTransport
class StdioTransport implements Transport
Constants
| protected STDERR_LIMIT |
|
Properties
| protected Process|null | $process | ||
| protected StdioInput|null | $input | ||
| protected string | $buffer | ||
| protected string | $stderr | ||
| protected float | $timeoutSeconds |
Methods
Create a subprocess transport.
Start the subprocess if it is not already running.
Detach the owned state and stop the subprocess.
Set the maximum idle time while awaiting a response.
Get the configuration needed to recreate this transport.
Write a newline-delimited protocol message.
Receive the next complete protocol message.
Read retained and incoming output until a complete message is available.
Retain a bounded diagnostic tail without leaving stderr in the process buffer.
Append standard output and detect a complete message.
Remove the next complete line from the retained output.
Disconnect and report a transport failure.
Disconnect any remaining subprocess.
Details
at line 38
__construct(string $command, array $args = [], array $env = [])
Create a subprocess transport.
at line 45
void
connect()
Start the subprocess if it is not already running.
at line 68
void
disconnect()
Detach the owned state and stop the subprocess.
at line 85
void
setTimeoutSeconds(float $seconds)
Set the maximum idle time while awaiting a response.
at line 95
array
recipe()
Get the configuration needed to recreate this transport.
at line 111
void
send(string $message, array $headers = [])
Write a newline-delimited protocol message.
at line 130
string
receive()
Receive the next complete protocol message.
at line 142
protected string
readNextLine(Process $process)
Read retained and incoming output until a complete message is available.
at line 187
protected void
drainErrorOutput(Process $process)
Retain a bounded diagnostic tail without leaving stderr in the process buffer.
at line 197
protected bool
bufferUntilNewline(string $type, string $chunk)
Append standard output and detect a complete message.
at line 211
protected string|null
popLine()
Remove the next complete line from the retained output.
at line 228
protected never
failWith(string $message)
Disconnect and report a transport failure.
at line 250
__destruct()
Disconnect any remaining subprocess.