module Minitest

def self.autorun

def self.autorun
  at_exit {
    next if $! and not ($!.kind_of? SystemExit and $!.success?)
    exit_code = nil
    at_exit {
      @@after_run.reverse_each(&:call)
      exit exit_code || false
    }
    exit_code = Minitest.run ARGV
  } unless @@installed_at_exit
  @@installed_at_exit = true
end