在不退出 Pry 的情况下使 Byebug 完成执行 [英] Make Byebug finish executing without exiting Pry

查看:40
本文介绍了在不退出 Pry 的情况下使 Byebug 完成执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 Rails 中使用 Byebug 设置断点时,有时我希望它完成执行,但 github 上的指南说使用 exit 也退出 Pry.如果断点在循环中,重复键入 continue 可能会很烦人.

When I set a breakpoint with Byebug in Rails, I sometimes want it to finish executing, but the guide on github says to use exit which also exits Pry. Typing continue repeatedly can be annoying if the breakpoint is in a loop.

有没有办法在不退出 Rails 控制台的情况下停止 byebug?

Is there anyway to stop byebug without exiting the Rails console?

推荐答案

在 Rails 控制台或 Rails 的服务器下运行 byebug 时,我通常只通过按 Ctrl+D.

When running byebug under the Rails console or in Rails' server I usually quit only byebug by hitting Ctrl+D.

这种方法的问题是,如果您在 Rails 的服务器中执行此操作,那么下次 Byebug 在您的代码中的任何位置遇到 byebug 语句时都不会停止和调试.但它在 Rails 控制台中完美运行.

The catch with this approach is, if you do this in Rails' server then Byebug will not stop and debug the next time it hits a byebug statement in your code anywhere. But it works perfectly in the Rails console.

这篇关于在不退出 Pry 的情况下使 Byebug 完成执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆