0x2c7/ruby_jard

[BUG] Can't type

chalmagean opened this issue ยท 8 comments

Describe the bug
I'm trying to use it with a Rails 6 app, in test mode. Namely I am adding the breakpoint in a controller and running my cucumber tests.

Jard starts and displays everything, but I cannot interact with it in any way. Only thing I can do is C-c to quit.

The gem is included in my development and test groups.

Environment (please complete the following information):

  • OS
    Mac OS 10.15.6
  • Terminal Emulator
    iTerm2 (with zsh)
  • Output when you run tput colors in your terminal
    256
  • Output when you run echo $TERM in your terminal
    xterm-256color
  • Output when you run stty
    speed 38400 baud;
    lflags: echoe echok echoke echonl echoctl pendin
    iflags: istrip iutf8 ignbrk
    oflags: -oxtabs
    cflags: cs8 -parenb
  • Do you use tmux/screen or similar tty multiplexer?
    no
0x2c7 commented

I did tested with a Rails 6 app and cucumber. It works really fine to me.

Screenshot from 2020-09-19 15-07-46

Could you provide some screenshots so that I can have more information to debug better? And if it's possible, could you please test in some scenarios:

  • Re-run that cucumber test, and use byebug instead.
  • Run the same rails app with web server

Tried it again, and I've attached screenshots. Byebug works fine, but jard doesn't work in either cucumber or the app.

2020-09-20 at 13 39
2020-09-20 at 13 38
2020-09-20 at 13 36

0x2c7 commented

@chalmagean, when you press Ctrl+C, does it print out any messages? When you type something, does Jard echo any character you totally silent? If you type something meaningful, and press enter, what happens? And if it's possible, could you please test with a normal ruby file, instead of Rails stack?

Sorry, it's a lot of questions to ask, but I try a lot of scenarios, but sitll can't re-produce this bug ๐Ÿ˜ž

Ok, so here's more debugging.

The output is totally silent. But if I do write something and press enter, I get output back. This doesn't happen in a regular ruby file (so I'm guessing it's a gem in my rails app; I've also attached the Gemfile).

ruby-class
ctrl-c
2020-09-20 at 18 20
jard_errors.txt
Gemfile.txt

0x2c7 commented

Ahh. The symptom looks familar now. So, my guess is that there is something wrong happens with the STDOUT of your rails app so that the output from jard is accumulated, and release when it meets \n. Cucumber may be the one did that. I did an enhancement with STDOUT redirection, but not yet released. Not 100% sure that it's relevant, but worth a try. Could you try again with master branch?

gem 'ruby_jard', git: 'https://github.com/nguyenquangminh0711/ruby_jard', ref: 'master'

master works the same.

0x2c7 commented

Hi @chalmagean, sorry for letting you waiting. In your Gemfile. I tested my local rails app again using your Gemfile. It does meet the same issue as you described. In your Gemfile, this file creates a conflict with Jard: gem "rb-readline". That library claims to be backward-compatible with Ruby Readline's interfaces, but seems like it's not. Removing that line solved the issue.

Oh! Thank you, I think I've added that some time ago because pry or byebug didn't work right.

I can confirm it's working fine now.

Thanks again for your help and this amazing gem.