summaryrefslogtreecommitdiff
path: root/lib/irb/cmd/force_exit.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/irb/cmd/force_exit.rb')
-rw-r--r--lib/irb/cmd/force_exit.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/irb/cmd/force_exit.rb b/lib/irb/cmd/force_exit.rb
new file mode 100644
index 0000000000..2b9f296865
--- /dev/null
+++ b/lib/irb/cmd/force_exit.rb
@@ -0,0 +1,22 @@
+# 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(0)
+ end
+ end
+ end
+
+ # :startdoc:
+end