Sha256: fc48bbeb6c4638d91e717dd1561f6230d0d70598bf20d9428275cfed54892d7c

Contents?: true

Size: 572 Bytes

Versions: 2

Compression:

Stored size: 572 Bytes

Contents

module CrashReporter
  OUTPUT_LINES_TO_REPORT = 70

  def report_crash reply_exchange, info
    stdout = `tail -n #{OUTPUT_LINES_TO_REPORT} #{info[:out_file]}`
    stderr = `tail -n #{OUTPUT_LINES_TO_REPORT} #{info[:err_file]}` + \
    info[:footer_text]

    send_crash_message reply_exchange, stdout, stderr

    "#{stdout}\n#{stderr}"
  end

  def send_crash_message reply_exchange, output, error
    reply = {:type => :crash, :hostname => Socket.gethostname,
      :stdout => output, :stderr => error}
    reply_exchange.publish(Yajl::Encoder.encode(reply))
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gorgon-0.3.1 lib/gorgon/crash_reporter.rb
gorgon-0.3.0 lib/gorgon/crash_reporter.rb