ruby/lib/irb/cmd/force_exit.rb
tomoya ishida 06995eb45b [ruby/irb] Fix exit! command warning and method behavior
(https://github.com/ruby/irb/pull/868)

* Fix exit! command warning and method behavior

* Remove arg(0) from Kernel.exit and Kernel.exit!

372bc59bf5
2024-02-12 11:28:54 +00:00

22 lines
346 B
Ruby

# frozen_string_literal: true
require_relative "nop"
module IRB
# :stopdoc:
module ExtendCommand
class ForceExit < Nop
category "IRB"
description "Exit the current process."
def execute(*)
throw :IRB_EXIT, true
rescue UncaughtThrowError
Kernel.exit!
end
end
end
# :startdoc:
end