def wait_for_output(term, variables)
      # now we should catch 'error' from terminal: it will contain approximation data
      # but we can get a real error instead of output, so lets wait for limited time
      start = Time.now
      output = ''
      until output_ready?(output, variables)
        begin
          term.check_errors(raw: true)
        rescue GnuplotRB::GnuplotError => e
          output += e.message
        end
        if Time.now - start > Settings.max_fit_delay
          fail GnuplotError, "Seems like there is an error in gnuplotrb: #{output}"
        end
      end
      output
    end
def wait_for_output(term, variables)
      # now we should catch 'error' from terminal: it will contain approximation data
      # but we can get a real error instead of output, so lets wait for limited time
      start = Time.now
      output = ''
      until output_ready?(output, variables)
        begin
          term.check_errors(raw: true)
        rescue GnuplotRB::GnuplotError => e
          output += e.message
        end
        if Time.now - start > Settings.max_fit_delay
          fail GnuplotError, "Seems like there is an error in gnuplotrb: #{output}"
        end
      end
      output
    end
It takes some time to produce output so here we need
 to wait for it.

 Max time to wait is stored in Settings.max_fit_delay, so one
 can change it in order to wait longer.