burke / zeus

Boot any rails app in under a second.
MIT License
3.33k stars 231 forks source link

Messing up terminal input buffer #624

Closed mkllnk closed 7 years ago

mkllnk commented 7 years ago

Description of Problem

Since version 0.15.13 zeus slave commands leave the terminal in a dirty state. Version 0.15.12 seems to work fine on a new project.

System details

Steps to Reproduce

1) zeus start in a new rails project

2) zeus test or zeus server or any other.

Observed Behavior

After the tests finish, my keyboard input doesn't show up until I hit enter. The output is then formatted in the wrong way like this:

localhost:/tmp/rails/blog$ zeus test
Run options: --seed 23423

# Running:

Finished in 0.003751s, 0.0000 runs/s, 0.0000 assertions/s.

0 runs, 0 assertions, 0 failures, 0 errors, 0 skips
localhost:/tmp/rails/blog$ ^C
                              localhost:/tmp/rails/blog$ ^C
                                                            localhost:/tmp/rails/blog$ app  config     custom_plan.rb  Gemfile       lib  public    README.rdoc  tmp     zeus.json
                                       bin  config.ru  db              Gemfile.lock  log  Rakefile  test         vendor
sideshowcoder commented 7 years ago

I've seen this with 0.15.x (versions before 13) as well, and thought I caught the cases but apparently I didn't :( thanks for reporting! As a quick fix if you want to avoid restarting your terminal there is the shell reset command which will fix this issue.

mkllnk commented 7 years ago

Thank you, I didn't know about reset. 0.15.4 works quite well for me. Sticking to that for a while. Awesome software by the way.

typeoneerror commented 7 years ago

Can confirm I've seen this since 0.15.12. reset is super handy, thanks @sideshowcoder!

Currently I end in a "dirty" state every 2-3 times running rspec. Reset is great, but it definitely seems to get worse as you work.

ylansegal commented 7 years ago

Instead of reset, I have also been using stty sane. It executes a bit faster then reset. Of course, it's still annoying that it's happening in the first place.

typeoneerror commented 7 years ago

I switched back to 0.15.10 which gives me the "Terminated" error but doesn't force me to reset the console every 2-3 times I run rspec. I did notice an actual stack trace in the window that I did zeus start though and that window messed up the buffer too. I'll see if I can grab that stack trace next time it happens.

laughinghan commented 7 years ago

I'm having a similar issue with Zeus v0.15.13 that's very easy to reliably reproduce, simply do:

$ (sleep 1; echo lol; echo wut) & zeus s
=> Booting WEBrick
=> Rails 4.2.3 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
lol
   wut

Notice the odd position of wut. By contrast:

$ (sleep 1; echo lol; echo wut) & rails s
=> Booting WEBrick
=> Rails 4.2.3 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
lol
wut

This is extremely easy to fix, I don't even need to reset, I can just Ctrl-Z and then fg and it's fixed, but I'd love to not have to do that in the first place. (I realize that zeus start takes control of the terminal cursor so anything running in the background that logs to stdout is no-go; but zeus s is supposed to be just like rails s and in particular has line output right, there's no reason you shouldn't run anything in the background that logs to stdout is there?)

(edit: actually zeus start doesn't take control of the entire terminal, but it does take control of the terminal cursor)

siassaj commented 7 years ago

+1

prpetten commented 7 years ago

My fix didn't work, so I removed it.

sideshowcoder commented 7 years ago

I shipped 0.15.14.pre which should fix this issue finally if people could test that that would be great.

michaelglass commented 7 years ago

clearly better, also introduced a different minor regression: previously, some pages would allow internal scrolling (e.g. like with less). I don't know the mechanism there but it no longer works.

ylansegal commented 7 years ago

I installed 0.15.14.pre but it doesn't work for me: My app doesn't even boot correctly. zeus start results in all the processes shown in red and then:

slavenode.go:226: [boot] read unix ->: EOF
exit status 1

I can't get more detail on what is happening. Running a console or specs results in:

zeus rspec
read unix ->: EOF%

Is there a way to print more debugging information?

sideshowcoder commented 7 years ago

You can pass --log somelogfile.log and read in there likely some gem version require messup I suspect, at least that is what I run into most. Hope that helps @ylansegal

ylansegal commented 7 years ago

@sideshowcoder, thanks for the tip. It was indeed a gem activation issue.

My initial testing of 0.15.14.pre: Seems like the terminal issues have been resolved. I'll have more time to explore tomorrow during my regular-day usage. I'll report back.

yld commented 7 years ago

Problem vanished. Thank you.

ylansegal commented 7 years ago

After a bit more testing, I can report the issue is solved for me.

jgeiger commented 7 years ago

Thanks for fixing this.