phasync
ProcessInterface / read

Method

ProcessInterface::read

Waits until the stream has something to read, and returns what is there.

Description#

public ProcessInterface::read(
    int $fd = self::STDOUT
): string|false

Returns an empty string at the end of the stream. The stream is closed once the process has ended and was noticed to have: a read then throws an IOException.

Parameters#

$fd int = self::STDOUT
ProcessInterface::STDOUT or STDERR

Return values#

What was read string|false

Errors / Exceptions#

ExceptionWhen
phasync\IOExceptionIf the stream is closed

See also#