phasync
ProcessInterface / write

Method

ProcessInterface::write

Waits until the stream can take data, and writes as much as it takes.

Description#

public ProcessInterface::write(
    string $data,
    int $fd = self::STDIN
): int|false

Parameters#

$data string
What to write
$fd int = self::STDIN
ProcessInterface::STDIN

Return values#

The number of bytes written, which may be less than all of $data; false if the process is not running int|false

Errors / Exceptions#

ExceptionWhen
phasync\IOExceptionIf the stream is closed

See also#