diff options
author | Ignacio Chiazzo Cardarello <ignaciochiazzo@gmail.com> | 2024-02-10 19:07:48 -0300 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2024-02-10 22:07:53 +0000 |
commit | 429eeb09f25bd1bd3f64f70c6ef409bedd3c6c1f (patch) | |
tree | eb2d72bf3bb9c063cf6bf4e7ac0c6a4f77db098b /lib/irb/cmd | |
parent | f960fbc10256ee227ad6887089388e0bda59aab5 (diff) |
[ruby/irb] Introduce exit! command
(https://github.com/ruby/irb/pull/851)
* Added failing test for when writing history on exit
* Save history on exit
* Exit early when calling Kernel.exit
* use status 0 for kernel.exit
* Added test for nested sessions
* Update lib/irb.rb
---------
https://github.com/ruby/irb/commit/c0a5f31679
Co-authored-by: Stan Lo <stan001212@gmail.com>
Diffstat (limited to 'lib/irb/cmd')
-rw-r--r-- | lib/irb/cmd/exit_forced_action.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/irb/cmd/exit_forced_action.rb b/lib/irb/cmd/exit_forced_action.rb new file mode 100644 index 0000000000..e5df75b682 --- /dev/null +++ b/lib/irb/cmd/exit_forced_action.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +require_relative "nop" + +module IRB + # :stopdoc: + + module ExtendCommand + class ExitForcedAction < Nop + category "IRB" + description "Exit the current process." + + def execute(*) + IRB.irb_exit! + rescue UncaughtThrowError + Kernel.exit(0) + end + end + end + + # :startdoc: +end |