Rails console on linux always shows \r at end of every line
Asked Answered
M

1

8

A standard rails console on a long running rails project has always worked fine on macOS. Recently switched to Ubuntu 18.04, and the rails console in bash and gnome-terminal will always append a \r at the end of every line like so:

Loading development environment (Rails 4.2.8)
irb(main):001:0> \r
irb(main):002:0> \r
irb(main):003:0> User.count\r
   (1.5ms)  SELECT COUNT(*) FROM "users"
=> 3
irb(main):004:0> 

This new behavior also affects scrolling up/down through previous commands, where it will not correctly clear a command and append the previous command after a command.

The .bashrc is the default, with no changes, and default gnome-terminal. (Tested removing changes and issue still appears).

Macaluso answered 23/5, 2018 at 22:5 Comment(1)
I'm having the same issue on a Rails 5.0.1 project. Recently upgraded to Ubuntu 18.04 too. What is weird is that it only happens for one of my projects. My other projects are all using Rails 5.1, not sure if that is the reason. I also tried with different ruby versions (2.4.1 and 3.1). I'm using zsh with zprestoEmanation
M
11

I figured it out eventually:

bundle update rb-readline

And the problem goes away!

Macaluso answered 13/6, 2018 at 1:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.