protected function readStream(&$stream, &$output) {
    $content = stream_get_contents($stream);
    if (strlen(rtrim($content))) {
      foreach (preg_split('/\r?\n/', $content) as $line) {
        $output[] = $line;
      }
    }
  }