Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Heroku: Fix "SignalException: SIGHUP" errors
#!/usr/bin/env ruby
APP_PATH = File.expand_path("../../config/application", __FILE__)
require_relative "../config/boot"
# Make a clean exit on Heroku while running a rails console.
# Without this we'll get a "SignalException: SIGHUP" error in honeybadger.
if ENV["DYNO"]
if ["c", "console"].include?(ARGV.first)
Signal.trap("SIGHUP") { exit 0 }
end
end
require "rails/commands"
@taylorbrooks

This comment has been minimized.

Copy link

@taylorbrooks taylorbrooks commented Jun 14, 2019

@tskogberg Where did you put this code? In an initializer?

@MarinaMurashev

This comment has been minimized.

Copy link

@MarinaMurashev MarinaMurashev commented Nov 21, 2019

@taylorbrooks i think this goes into bin/rails

@MarinaMurashev

This comment has been minimized.

Copy link

@MarinaMurashev MarinaMurashev commented Nov 21, 2019

@tskogberg thank you for this script, I just used it and worked like a charm! 👏

@saferodrigo

This comment has been minimized.

Copy link

@saferodrigo saferodrigo commented Jul 29, 2020

this works only with heroku?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment