Guard: Typing doesn't appear in terminal after exiting guard

Created on 13 Aug 2014  ·  23Comments  ·  Source: guard/guard

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).

Most helpful comment

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

All 23 comments

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

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?

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

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.

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.

Ah, okay. Thanks!

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

@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.

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

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.

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

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

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.

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.

I submitted an issue here: https://github.com/guard/guard-zeus/issues/18

Needs changes in Zeus to support this though.

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

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

Nice! Followed.

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?

@bf4 -

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

Absolutely! It would be much appreciated!

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.

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

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 <
[email protected]> 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
https://github.com/guard/guard/issues/619#issuecomment-90688628.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Antti picture Antti  ·  4Comments

greyblake picture greyblake  ·  18Comments

jonmchan picture jonmchan  ·  16Comments

Odaeus picture Odaeus  ·  21Comments

thibaudgg picture thibaudgg  ·  3Comments