readlines

in lib/gdk/shellout.rb [84:105]


    def readlines(limit = -1, &block)
      @stdout_str = ''
      @stderr_str = ''
      lines = []

      Open3.popen2(env, *args, opts) do |_stdin, stdout, thread|
        stdout.each_line do |line|
          if limit == -1 || lines.count < limit
            lines << line.chomp
            yield line if block
          end
        end

        thread.join
        @status = thread.value
      end

      @stdout_str = lines.join("\n")

      lines
    end