Make sure to stop byebug if eval raised #369
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When I put a pry in a loop, it's frequent that when i'm done, I just use
!!!
to raise an exception which ends my current rails query.Since I start using pry-byebug, I noticed that doing so made the whole interpreter like 8x slower.
Investigation made me learn that if an exception is raised using commands, this bypasses the usual mechanism that stops byebug, leading to a slow interpretter.
This fixes that behavior by detecting that an exception is propagating out of eval and stopping byebug.
I would assume that situation also happened when someone used the raise-up command.
I don't know enough about Pry, but I would guess this exact fix may be wrong when dealing with nested pry. So there may be some extra-checks needed to make sure we are not nested, but I don't know how to do that.