'byebug isn't displaying the output as I type
I've experienced an odd interface glitch.
[44, 53] in /document.rb
44: code
45: code
46:
47: def code
48: byebug
=> 49: code
50: code
51: code
52: end
53:
(byebug) {here is where you type}
When I type, the characters are not displayed at all. I can type p "yo"
or whatever I want, and when I hit enter
it runs the code. Essentially I can use byebug in a pinch, but it's really frustrating when I can't see what I'm typing.
I've used byebug in the past with this same laptop, and this issue is fairly recent.
I was assisting a friend, and when he used byebug the same issue happened. I haven't been able to find anything online.
Solution 1:[1]
TL;DR: Add this line in config/puma.rb
:
# Specifies the `worker_timeout` threshold that Puma will use to wait before
# terminating a worker in development environments.
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
Reproducing & Why this is happening
In development mode, set a debugger
in a controller action and send a request to this action (e.x. index
). After 60 seconds Puma, Rails' default server, will terminate the worker. Unfortunately, the next time a debugger
is triggered you will be unable to see any text you type in the terminal.
This is a known bug and is fixed in Rails 7+. The above line was added to change Puma's worker timeout to a more appropriate level (1 hour) when in development mode.
Other Causes
- As u/casper pointed out in a comment above, Spring can also cause similar behaviour. Stop your server and run
bin/spring stop
and this may resolve your issue. - If you're experience only some text appear when you type, this may be a result of parallelized tests. For example, if you type,
"Hello World"
but only"Hol"
appears (i.e. some letters), you can disable parallelized tests following u/sajad-rastegar's advice above. Simply comment this line intest/test_helper.rb
:parallelize(workers: :number_of_processors)
.
Solution 2:[2]
This problem occurs when the tests run in parallel. Commenting this line in test_helper
should fix the problem:
parallelize(workers: :number_of_processors)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Matt |
Solution 2 | Sajad Rastegar |