class Fig::AtExit

This exists because standard Kernel#at_exit blocks don't get run before Kernel#exec.

Constants

EXIT_PROCS

Public Class Methods

add(&block) click to toggle source
# File lib/fig/at_exit.rb, line 8
def self.add(&block)
  EXIT_PROCS << block

  return
end
execute() click to toggle source
# File lib/fig/at_exit.rb, line 14
def self.execute()
  EXIT_PROCS.each do
    |proc|

    begin
      proc.call()
    rescue StandardError => exception
      $stderr.puts(
        [
          %q<Got exception from "at exit" processing.>,
          exception.message,
          exception.backtrace
        ].flatten.join("\n")
      )
    end
  end

  return
end