public function send($input)
    {
        if (!$this->isAlive()) {
            throw new LogicException('Process is not alive.');
        } elseif (!$this->interactive) {
            throw new LogicException("Process [{$this->pid}] not running interactively.");
        }

        $bytes = fwrite($this->pipes[static::STDIN], $input, strlen($input));
        if ($bytes === false) {
            $this->kill();
            throw new ProcessException("Error sending [$input] to $this stdin.", $this);
        }
    }