Class: ScoutApm::Agent::ExitHandler
- Inherits:
-
Object
- Object
- ScoutApm::Agent::ExitHandler
- Defined in:
- lib/scout_apm/agent/exit_handler.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
-
#initialize(context) ⇒ ExitHandler
constructor
A new instance of ExitHandler.
- #install ⇒ Object
Constructor Details
#initialize(context) ⇒ ExitHandler
Returns a new instance of ExitHandler.
6 7 8 |
# File 'lib/scout_apm/agent/exit_handler.rb', line 6 def initialize(context) @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
4 5 6 |
# File 'lib/scout_apm/agent/exit_handler.rb', line 4 def context @context end |
Instance Method Details
#install ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/scout_apm/agent/exit_handler.rb', line 10 def install logger.debug "Shutdown handler not supported" and return unless exit_handler_supported? logger.debug "Installing Shutdown Handler" at_exit do logger.info "Shutting down Scout Agent" # MRI 1.9 bug drops exit codes. # http://bugs.ruby-lang.org/issues/5218 if environment.ruby_19? status = $!.status if $!.is_a?(SystemExit) shutdown exit status if status else shutdown end end end |