guard/guard — pull request #593 by e2 (2014-04-30 11:46:12+00:00)
Title: Quick hack for Pry 'temporarily locked' errors

NOTE: NOT FOR MERGING (yet!)

This is a quick hack to try and avoid the interactor errors related to THIS Pry error:
```
Error: can't modify string; temporarily locked
```

## NOTES AND WARNINGS
- this patch tries a few things to work around the problem
- this patch disables the guard prompt extras (e.g. paused state, etc.), so the prompt is different
- this patch isn't properly tested and has no test cases for reproducing the error
- there can be side effects of this patch (e.g. multiple tmux calls when existing guard)

## HOW TO USE:

In your Gemfile, use guard from this branch:

```ruby
gem 'guard', github: 'guard', branch: 'attempt_to_fix_pry_crashes'
```

Then, restart Guard and try and get it to crash with the above "temporarily locked" error.

Then, report any side effects or feedback that could be related to the patches.

## DETAILS

The cause of the error is Ruby's ext/readline locking the **prompt** string, which is created by Guard and passed to Pry to Readline.

The currently released version of Guard runs Pry in an unsafe way (threads) and overrides the prompt, so I'm not really sure what the actual cause is and how it should be fixed (in a minimal way).

So I'm doing a few things to **guess**:
1. locking the variable to eliminate threading related instance variable overwriting/race conditions
2. removing the guard prompt config - in case the prompt is somehow unsafely used by Pry
3. reordering the code a bit

## For the advanced

Any suggestions are welcome, especially feedback on whether the prompt can be restored after the patch and it's still ok.