mirror of
https://github.com/ruby/ruby.git
synced 2025-09-20 19:14:00 +02:00

(https://github.com/ruby/irb/pull/867)
* Remove IRB.irb_exit! method
It's not necessary to introduce a new method just for the exit! command
at this moment.
* Rename ExitForcedAction to ForceExit
* Move force exit tests to a dedicated file
* Fix nested history saving with exit! command
Because we switched to use `Kernel#exit` instead of `exit!`, the outer
session's ensure block in `Irb#run` will be run, which will save the
history. This means the separate check to save history when force exiting
is no longer necessary.
* execute_lines helper should also capture IRB setup's output
This prevents setup warnings from being printed to test output
while allowing those output to be tested.
* Update readme
899d10ade1
22 lines
348 B
Ruby
22 lines
348 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(0)
|
|
end
|
|
end
|
|
end
|
|
|
|
# :startdoc:
|
|
end
|