protected function setStdIn()
    {
        if ($this->stdIn !== false) {
            fclose($this->stdIn);
        }

        $this->stdIn = fopen('php://stdin', 'r');

        if (!$this->stdIn) {
            throw new RuntimeException('Unable to read from STDIN');
        }
    }