0

I have a strange behaviour in my rails console since last reboot of my system (which is kind of strange since nothing change, as far as I can tell atm) I'm using Windows 10 as host, Ubuntu 18.04 via WLS2, rails 6.1.0 and ruby 2.7.2p137 installed via rvm. As editor I use VSCode. When I launch 'rails console' I get this:

Running via Spring preloader in process 2547
Loading development environment (Rails 6.1.0)
2.7.2 :001?> ^[[13;1R^[[13;1R

I have no idea what's going on here. So if you need further info about my setup, please ask.

Dharman
  • 30,962
  • 25
  • 85
  • 135
nurbs999
  • 87
  • 10

2 Answers2

1

I was having this problem too, sounds like your console is starting with some ansi escape codes. https://stackoverflow.com/questions/16755142/how-to-make-win32-console-recognize-ansi-vt100-escape-sequences?r=SearchResults&s=1|280.0292 I tried several things in the article including installing ansicon and creating the registry key for the virtual terminal. The reason I mention it as there was no immediate effect is I still have the ansicon installed. I am also using VScode with extensions for Ruby and all those pretty colors I like to see while I'm writing code. So I disabled VScode Ruby 0.28.0 with syntax highlighting which said "Hey your ruby extensions require this are you sure?" I clicked yes disabled everything. My console was back to normal. I was able to re-enable all my extensions and reload VSCode everything works up to this point.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Sevin
  • 43
  • 1
  • 6
  • Extensions! Thank you! I recently installed some of the RoR extensions in VSCode. One of them seems to be the problem. What's weird thou, I just needed to disable an reenable one of them to get rid of the escape codes. – nurbs999 Apr 11 '21 at 16:16
  • Suddenly, this did not help. After reloading WSL and VSCode the escape codes reappeared – nurbs999 Apr 11 '21 at 16:35
0

I figured it out. The situation is that VSCode is opening xterm within a bash with a profile. The profile file is ~/.bashrc, this is normal in a Linux environment. But there are some lines for setting the a title:

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

I commented out this lines. I also needed to restart the VM. Open a powershell and enter:

wsl.exe --shutdown

After that restart your VM via launching Ubuntu.

nurbs999
  • 87
  • 10