Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HISTORY is unavailable when using rails console with RUBY_DEBUG_IRB_CONSOLE=1 #975

Closed
tompng opened this issue Jun 18, 2024 · 1 comment · Fixed by #1046
Closed

HISTORY is unavailable when using rails console with RUBY_DEBUG_IRB_CONSOLE=1 #975

tompng opened this issue Jun 18, 2024 · 1 comment · Fixed by #1046
Labels
bug Something isn't working

Comments

@tompng
Copy link
Member

tompng commented Jun 18, 2024

Description

Rails console HISTORY is unavailable with RUBY_DEBUG_IRB_CONSOLE=1

Preparation

Create new rails app with rails new appname.
Add gem 'spring' to Gemfile and run spring binstub --all. (This step is optional)

versions are:

debug (1.9.2)
reline (0.5.9)
irb (1.13.2)
rails (7.1.3.4)
spring (4.2.1)

Reproduce

Without spring

$ rails c
irb(main):001> Up arrow shows history
$ RUBY_DEBUG_IRB_CONSOLE=1 rails c
irb(main):001> Up arrow does not show history

With spring

$ rails c
irb(main):001> HISTORY available
$ RUBY_DEBUG_IRB_CONSOLE=1 rails c
irb(main):001> HISTORY available (until `spring stop`)
$ spring stop
$ RUBY_DEBUG_IRB_CONSOLE=1 rails c
irb(main):001> HISTORY unavailable
$ rails c
irb(main):001> HISTORY unavailable (until `spring stop`)
$ spring stop
$ rails c
irb(main):001> HISTORY available

Result of irb_info

irb(main):001> irb_info
Ruby version: 3.3.1
IRB version: irb 1.13.2 (2024-06-15)
InputMethod: RelineInputMethod with Reline 0.5.9 and /Users/tomoya.ishida/.inputrc
Completion: Autocomplete, RegexpCompletor
RUBY_PLATFORM: arm64-darwin22
LANG env: ja_JP.UTF-8
East Asian Ambiguous Width: 1
@st0012 st0012 added the bug Something isn't working label Dec 11, 2024
sunblaze added a commit to sunblaze/irb that referenced this issue Dec 12, 2024
When starting a debug session directly with RUBY_DEBUG_IRB_CONSOLE=1 and
`require 'debug'; debugger`, IRB's history wasn't loaded. This commit ensures
history is loaded in this case by calling `load_history` when configuring IRB
for the debugger.

Fixes ruby#975
@st0012
Copy link
Member

st0012 commented Dec 12, 2024

I think the issue is just between debug and IRB. It shows up in Rails console likely because it requires and activates debug by default and thus turning Rails console's IRB into a irb:rdbg session.

st0012 added a commit that referenced this issue Dec 12, 2024
* Load history when starting a direct debug session

When starting a debug session directly with RUBY_DEBUG_IRB_CONSOLE=1 and
`require 'debug'; debugger`, IRB's history wasn't loaded. This commit ensures
history is loaded in this case by calling `load_history` when configuring IRB
for the debugger.

Fixes #975

* Update test/irb/test_history.rb

* Update lib/irb/debug.rb

---------

Co-authored-by: Stan Lo <[email protected]>
matzbot pushed a commit to ruby/ruby that referenced this issue Dec 12, 2024
(ruby/irb#1046)

* Load history when starting a direct debug session

When starting a debug session directly with RUBY_DEBUG_IRB_CONSOLE=1 and
`require 'debug'; debugger`, IRB's history wasn't loaded. This commit ensures
history is loaded in this case by calling `load_history` when configuring IRB
for the debugger.

Fixes ruby/irb#975

* Update test/irb/test_history.rb

* Update lib/irb/debug.rb

---------

ruby/irb@7f851b5353

Co-authored-by: Stan Lo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants