Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing doesn't appear in terminal after exiting guard #619

Closed
mockdeep opened this issue Aug 12, 2014 · 23 comments
Closed

Typing doesn't appear in terminal after exiting guard #619

mockdeep opened this issue Aug 12, 2014 · 23 comments

Comments

@mockdeep
Copy link

I've been running into this strange behavior for a while. I'll exit guard with ctrl+D and when I get a bash prompt, nothing appears at the prompt when I type. I can type shell commands and they will execute, but no text appears as I type. The output from the commands typed does show up. Using GNU bash, version 4.2.25(1)-release (x86_64-pc-linux-gnu).

@e2
Copy link
Contributor

e2 commented Sep 14, 2014

Could be some stdout/stderr leftovers - or an undead pry session/thread.

@e2
Copy link
Contributor

e2 commented Oct 27, 2014

Guard 2.7.0 was released - do you still have the problem? If so, what is the last line that's making the prompt invisible?

@mockdeep
Copy link
Author

Thanks, I'll upgrade and see what happens this week.

@mockdeep
Copy link
Author

Just upgraded and I'm still seeing this issue. I'm not sure what you mean though by your second question. Guard is idle after running the specs, and when I press ctrl+D to exit I get my $ bash prompt, but nothing shows up after it when I try to type in a command.

@e2
Copy link
Contributor

e2 commented Oct 29, 2014

Guard uses LumberJack and I think it's the LumberJack thread(s) which doesn't get cleaned up (so when guard exits, LumberJack dumps the remaining output messages in the "background" after you get the shell prompt so ... the shell prompt gets hidden.

This will probably be fixed soon.

@mockdeep
Copy link
Author

Ah, okay. Thanks!

@e2 e2 mentioned this issue Oct 29, 2014
@bf4
Copy link

bf4 commented Nov 26, 2014

in the meantime, have you tried typing reset?

(I found this issue because when I'm running guard with pry-byebug, I can see what I type in my guard repl, but when I add a binding.pry to a file, I can't see what I'm typing in the that repl. Weird

@e2
Copy link
Contributor

e2 commented Nov 26, 2014

@bf4 - might be an issue with buffering. You can try putting in your Guardfile:

$stderr.sync = true
$stdout.sync = true

and doing the same somewhere in your app (e.g. before binding.pry).

That's just to see if doing so changes anything (synced output doesn't make sense to keep).

It might be also an issue with readline and Pry, so you may want to uninstall both and install Pry (and readline) according to whatever is currently recommended in their docs.

Or you might make sure you don't have a custom config somewhere.

@bf4
Copy link

bf4 commented Nov 26, 2014

I fixed it by removing readline-rb gem and editing the .editrc per osx
docs right before the readline suggestion. Ruby 2.1.4 via rvm on osx,
guard 2.7 and 2.9

@e2 e2 removed the infos needed label Dec 22, 2014
@e2
Copy link
Contributor

e2 commented Dec 22, 2014

I'm closing this since it seems to be a readline issue, not a Guard issue.

If there's anything I can do in Guard to prevent this (or fix this) - please reopen.

@e2 e2 closed this as completed Dec 22, 2014
@mockdeep
Copy link
Author

I think it may have actually been an issue with guard-zeus. When I removed that gem the problem disappeared.

@e2
Copy link
Contributor

e2 commented Dec 22, 2014

@mockdeep - strange. But thanks for letting me know. If I ever reproduce it (I use Linux), I'll resolve this.

@mockdeep
Copy link
Author

I was getting it pretty consistently when guard-zeus was plugged in. Just boot up guard, maybe run some specs, hit ctrl+D and presto. I'm using Linux, too.

@e2
Copy link
Contributor

e2 commented Dec 22, 2014

Yeah, the cool Zeus output updating interferes with Pry.

Workaround:

guard 'zeus', cli: '> /dev/null' do

The other workaround is of course to simply run Zeus in a separate terminal.

@e2
Copy link
Contributor

e2 commented Dec 22, 2014

I submitted an issue here: guard/guard-zeus#18

Needs changes in Zeus to support this though.

@mockdeep
Copy link
Author

Nice. I'll keep this in mind going forward if I run into any similar issues. For now we've switched to spring.

@e2
Copy link
Contributor

e2 commented Dec 23, 2014

If you're using spring on Linux, you may want to subscribe to this issue: rails/spring-watcher-listen#1 (basically, once I get to it, spring will use inotify on Linux instead of polling).

@mockdeep
Copy link
Author

Nice! Followed.

@bf4
Copy link

bf4 commented Jan 23, 2015

So, I see in the docs https://github.com/guard/guard/wiki/Add-Readline-support-to-Ruby-on-Mac-OS-X the .editrc fix I mentioned isn't there. I looked for it in the history, and it turns out it was in the Pry Docs

How can I get readline support (ctrl+r etc) for Pry in OSX?

Technically for OSX you don't need readline, and we'll focus on using libedit which OSX comes with instead.

Edit the file .editrc in your home directory. Add this line:

bind "^R" em-inc-search-prev

You can now use ctrl+r to do a reverse history search.

Ref: http://hints.macworld.com/article.php?story=20080313113705760

Alternatively, install GNU Readline and get Ruby to use it: https://github.com/guard/guard/wiki/Add-Readline-support-to-Ruby-on-Mac-OS-X

Finally, Pry does work with rb-readline, a pure Ruby implementation of Readline which shouldn't suffer from the platform and install dependencies of the standard Readline.
Ref: https://github.com/luislavena/rb-readline

It seems these docs talk to each other. May I add the editrc info or link to the pry docs?

@e2
Copy link
Contributor

e2 commented Jan 23, 2015

@bf4 -

May I add the editrc info or link to the pry docs?

Absolutely! It would be much appreciated!

bf4 added a commit to bf4/dotfiles that referenced this issue Jan 26, 2015
See guard/guard#619 (comment)

Technically for OSX you don't need readline, and we'll focus on using
libedit which OSX comes with instead.

Edit the file .editrc in your home directory. Add this line:

bind "^R" em-inc-search-prev
You can now use ctrl+r to do a reverse history search.

Ref: http://hints.macworld.com/article.php?story=20080313113705760

Alternatively, install GNU Readline and get Ruby to use it:
https://github.com/guard/guard/wiki/Add-Readline-support-to-Ruby-on-Mac-OS-X

Finally, Pry does work with rb-readline, a pure Ruby implementation of
Readline which shouldn't suffer from the platform and install
dependencies of the standard Readline.
Ref: https://github.com/luislavena/rb-readline
bf4 added a commit to bf4/dotfiles that referenced this issue Jan 26, 2015
See guard/guard#619 (comment)

Technically for OSX you don't need readline, and we'll focus on using
libedit which OSX comes with instead.

Edit the file .editrc in your home directory. Add this line:

bind "^R" em-inc-search-prev
You can now use ctrl+r to do a reverse history search.

Ref: http://hints.macworld.com/article.php?story=20080313113705760

Alternatively, install GNU Readline and get Ruby to use it:
https://github.com/guard/guard/wiki/Add-Readline-support-to-Ruby-on-Mac-OS-X

Finally, Pry does work with rb-readline, a pure Ruby implementation of
Readline which shouldn't suffer from the platform and install
dependencies of the standard Readline.
Ref: https://github.com/luislavena/rb-readline
@rahilsondhi
Copy link

I have this problem too. Even after a fresh restart, I'm using spring+guard, when I put a binding.pry breakpoint in my code, I cannot see anything I type. I tried adding bind "^R" em-inc-search-prev to ~/.editrc and restarted my terminal but that did not help. I tried reset too, did not help.

@bf4
Copy link

bf4 commented Apr 7, 2015

@rahilsondhi export DISABLE_SPRING=1 and all your troubles will go away

@rahilsondhi
Copy link

Thanks. I tried putting that in my terminal before starting guard - no
dice. I even removed spring from my Guardfile, no dice.

On Tue, Apr 7, 2015 at 11:21 AM, Benjamin Fleischer <
notifications@github.com> wrote:

@rahilsondhi https://github.com/rahilsondhi export DISABLE_SPRING=1 and
all your troubles will go away


Reply to this email directly or view it on GitHub
#619 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants