-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Rails console hangs with downward-pointing triangle #159
Comments
Just tried updating a couple things, and I still run into this with $ ruby --version
ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-linux]
$ bin/rails --version
Rails 6.1.4.6
$ bin/rails console -- --version
Running via Spring preloader in process 71796
Loading development environment (Rails 6.1.4.6)
irb 1.3.5 (2021-04-03) |
Hi! Any chance you started the console outside of Emacs first (after which Spring has cached its environment), and then started it inside Emacs? You can try removing Spring (at least for the duration of troubleshooting) and then repeating the attempt. If that fails, can you try stepping through |
To step through the function, move to its definition with Then repeat the usual scenario in Emacs, you should land in the interactive debugging at the beginning of that function. Step through it by repeatedly pressing To undo instrumentation, press |
I've removed Spring as a dependency, and confirmed that both |
That's odd. I have just tried this in a newly created Rails project, and it worked fine (no triangle). Rails 6.1.4.6, Ruby 3.0.2, IRB 1.3.5. More importantly, you're also saying you have There might be something in your project that counteracts this setting. Try creating a new Rails project. Does it exhibit the same problem? Also try Ruby 3.0.2 maybe (I don't have the time to compile a different version ATM), but the chances of that helping are really slim. |
No luck on my end, I'm afaid. I've upgraded to the latest Ruby and Rails — 3.1.1 and 7.0.2.2, respectively. I've created two brand new Rails projects:
In both new projects I still get the blue triangle when I run I've doubly verified that the console is getting the $ pgrep -af rails
31311 /home/chris/.homesick/repos/rbenv/versions/3.1.1/bin/ruby bin/rails console -e development -- --nomultiline And I've double-checked that my $ cat ~/.irbrc
IRB.conf[:USE_MULTILINE] = false if ENV['INSIDE_EMACS'] Here are the new package versions in case it matters. $ ruby --version
ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux]
$ bin/rails --version
Rails 7.0.2.2
$ bin/rails console -- --version
Loading development environment (Rails 7.0.2.2)
irb 1.4.1 (2021-12-25) |
Oh! But I just tried |
The next step would be to see whether any of the loaded gems modify But if you have a sample project ready which exhibits the problem, please zip it up and attach to this conversation, I'll take a look. |
|
I'm testing that now. Just had to do some rbenv juggling to install Rails. |
Yes, |
Interesting. I'll check it out, thanks. To be sure, you can still upload that sample project: after all, the problem could be a combination of Ruby 3.0.3's behavior and something in the project configuration. |
Ok, will do. 👍 One other thing — I'm just baffled because I can't see any meaningful difference between the irb sessions in 3.1.1 and 3.0.2. test-rails-3.1.1$ bin/rails console -- --nomultiline
irb(main):001:0> puts 'Hello'
Hello
=> nil
irb(main):002:0> test-rails-3.0.2$ bin/rails console -- --nomultiline
irb(main):001:0> puts 'Hello'
Hello
=> nil
irb(main):002:0> Same prompt, same ANSI coloring (just the |
The two test projects I've been using:
|
Just a quick question: does adding I.e. diff --git a/inf-ruby.el b/inf-ruby.el
index a3f5245..d898044 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -1066,7 +1066,7 @@ automatically."
;; Note: this only has effect in Rails < 5.0 or >= 5.1.4
;; https://github.com/rails/rails/pull/29010
(when (inf-ruby--irb-needs-nomultiline-p)
- " -- --nomultiline"))
+ " -- --nomultiline --nosingleline --noreadline"))
"rails")))
(defun inf-ruby-console-rails-env () Press |
I'll just mention one other thing that I hope isn't relevant. My system ruby is 3.0.2 (Fedora 35). I've been using rbenv for all my development — even for 3.0.2 — so I don't need root to install packages. That's why |
Yes, adding all those flags seems to fix the issue. I get an irb prompt in |
FWIW, I also use rbenv. And Ubuntu 20.04.
Nice. Please try removing each of them in turn to see which of the flags was necessary. Maybe both, but that's doubtful. |
It looks like Edit to add: |
Ah, what I missed is that So it's probably dependent on how Ruby was compiled rather on a particular version used. And I couldn't repro this with Ruby 3.0.3 now. If you have any further interest in finding out the reason, evaluating the following should help: Here, it prints Try running Either way, it seems adding |
I see you've already closed this issue, but I got a chance to try out what you suggested with Both my rails test projects (ruby 3.0.2 and 3.1.1) report the same. $ bin/rails console -- --nomultiline
Loading development environment (Rails 7.0.2.2)
irb(main):001:0> IRB.CurrentContext.io
=> ReadlineInputMethod with Reline 0.3.1
irb(main):002:0> Even Outside of a rails project, irb reports differently. $ irb --nomultiline
irb(main):001:0> IRB.CurrentContext.io
=> ReadlineInputMethod with ext/readline 8.1
irb(main):002:0> And for the record, when run with $ irb --nomultiline --noreadline
irb(main):001:0> IRB.CurrentContext.io
=> StdioInputMethod
irb(main):002:0>
$ bin/rails console -- --nomultiline --noreadline
Loading development environment (Rails 7.0.2.2)
irb(main):001:0> IRB.CurrentContext.io
=> StdioInputMethod Here I also get the same results when using the system ruby. So it does seem to be about system vs. rbenv, at least for picking the input method. From some quick research, it looks like additional install-time arguments are needed to make rbenv use the system readline library. I'm curious to give that a try and see if I get different results. Edit: I installed |
Thanks! Now we know that it is indeed the lack of Readline that caused the problem, and Reline's incompatibility with running inside Emacs.
That's what I wanted to say: as long as the And the system Ruby is different because it's been compiled on another computer already, so it doesn't depend on the |
Passing |
FWIW, using Ruby built without libreadline might still not be a good idea. If your project is large enough, completion can be slow with |
I know this is an old issue, but I'm running into it and I've tried the fix listed in the README. When I run
inf-ruby-console-auto
(or in my original case, try to use Robe), the console hangs. It shows the first two lines of output from Rails, but instead of a prompt just shows a blue, downward-pointing triangle. I can type but the console is unresponsive.Is there any chance this is a new bug? Or have I just missed something in my setup?
The text was updated successfully, but these errors were encountered: