You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expect to be able to use Readline.readline("answer me pls> ") within irb. Right now it does read my answer but the answer me pls> gets lost instead of sent to STDOUT. I can only reproduce the problem in Ruby 3.3.0. I am unable to reproduce the problem in Ruby 3.2.2 using the latest gems.
I am not 100% certain whether it is an irb, readline or reline problem but it does not happen outside of irb.
Reality
irb(main):001> require 'readline'
=> true
irb(main):002> Readline.readline('answer me pls> ')
irb(main):003> yes
=> "yes"
# Note, the 'answer me pls> ' is missing
Expectation
irb(main):001> require 'readline'
=> true
irb(main):002> Readline.readline('answer me pls> ')
answer me pls> ok
=> "ok"
without irb
ruby -rreadline -e "Readline.readline('answer me pls> ')"
answer me pls> '
Result of irb_info
Ruby version: 3.3.0
IRB version: irb 1.11.1 (2024-01-08)
InputMethod: RelineInputMethod with Reline 0.4.2
Completion: Autocomplete, RegexpCompletor
.irbrc path: /home/stillhart/.irbrc
RUBY_PLATFORM: x86_64-linux
LANG env: en_US.UTF-8
LC_ALL env: en_US.UTF-8
East Asian Ambiguous Width: 1
gem list irb reline readline
*** LOCAL GEMS ***
irb (1.11.2, 1.11.1, default: 1.11.0, 1.10.1, 1.7.4)
*** LOCAL GEMS ***
reline (0.4.2, default: 0.4.1, 0.3.8)
*** LOCAL GEMS ***
readline (default: 0.0.4)
Don't mind the messiness above, I just wanted to test the result and
for me it is displayed the prompt. As that is the first argument to
Readline.readline().
You showed that this works without irb, so we know this does work,
so the question then is why irb does not show it. My irb shows it
though. I am using Linux, but you said it also happens on redhat
7, which I assume is Linux.
That's a weird error. Perhaps something tampers with buffering?
Perhaps tompng can show some code to find out how to test
this behaviour of irb but from within a .rb file. Then you can
perhaps narrow this down. Evidently there must be some reason
for that behaviour but I am not sure what it is or should be; reline
should not interfere here since Readline.readline() is a specific
call to Readline, not to reline.
Description
I expect to be able to use
Readline.readline("answer me pls> ")
within irb. Right now it does read my answer but theanswer me pls>
gets lost instead of sent to STDOUT. I can only reproduce the problem in Ruby 3.3.0. I am unable to reproduce the problem in Ruby 3.2.2 using the latest gems.I am not 100% certain whether it is an irb, readline or reline problem but it does not happen outside of irb.
Reality
Expectation
without irb
Result of irb_info
Terminal Emulator
Vscode and iterm
Setting Files
OS
Happens both on Redhat7 and MacOS Sonoma
Working versions
Switching to older ruby versions such as 3.2.2 or 3.0.5 solves the problem for me, but that might be because of older dependencies.
Ruby 3.2.2 version
There is a chance that something is weird in my setup. I am happy to close this if it is not reproducible.
The text was updated successfully, but these errors were encountered: