/** * {@inheritdoc} */ public function end(string $data = '', float $timeout = 0) : \Generator { if (!$this->writable->isWritable()) { throw new UnwritableException('The stream is no longer writable.'); } try { $written = (yield from $this->writable->end($data, $timeout)); } finally { $this->readable->close(); } return $written; }
/** * @coroutine * * @return \Generator * * @throws \Icicle\Concurrent\Exception\StatusError If the process has not been started. */ public function join() : \Generator { if (null === $this->delayed) { throw new StatusError('The process has not been started.'); } $this->poll->listen(); try { return (yield $this->delayed); } finally { $this->stdout->close(); $this->stderr->close(); } }
/** * @coroutine * * @return \Generator * * @throws \Icicle\Concurrent\Exception\StatusError If the process has not been started. */ public function join() { if (null === $this->promise) { throw new StatusError('The process has not been started.'); } $this->poll->reference(); try { yield $this->promise; } finally { $this->stdout->close(); $this->stderr->close(); } }