开发者

Ruby - ruby-debug terminating without error on 'if __FILE__ == $0'

开发者 https://www.devze.com 2022-12-23 18:52 出处:网络
I\'m trying to use ruby-debug to debug this script I\'ve written and it keeps terminating on the line, if __FILE__ == $0. I step through each line before it, and then when it gets to that line it just

I'm trying to use ruby-debug to debug this script I've written and it keeps terminating on the line, if __FILE__ == $0. I step through each line before it, and then when it gets to that line it just q开发者_JS百科uits. No errors or anything, it just quits. How do I fix this?


Actually everything is working as it is supposed to. The if __FILE__ == $0 idiom basically translates to "if this file is the running program", which it is not if run from the debugger. See e.g. the following thread on ruby-talk for a discussion of this issue:

http://www.ruby-forum.com/topic/113859#new

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号