Closed vemv closed 8 years ago
Hi @vemv,
You can only access the breakpoints if you're inside a ForkBreak process. Picking up on your example above:
require 'fork_break'
class Foo
include ForkBreak::Breakpoints
def bar
breakpoints << :test
end
end
process = ForkBreak::Process.new { Foo.new.bar }
process.run_until(:test).wait # runs and stops at the :test breakpoint
process.finish # runs the process until finished
Check out the specs for another example. Perhaps a better error message would help in this case or perhaps skip breakpoints if not in a ForkBreak process.
Thanks,
Ah, I see. Thanks!
Hmmm. I had imagined that by default breakpoints were always skipped if the current process is not a ForkBreak one. Else adding breakpoints would break production code, wouldn't they?
As I see it, one should be free to add breakpoints to controllers/models/etc, which would be a no-op in production. That way one could use the same exact code in prod and test envs...
Thoughts?
Cheers - Victor
Yes, that makes perfect sense!
I'll try to cook up the next version ASAP with that in mind.
Many thanks!
Thanks to you!
I played quite a lot with fork_break last night and was able to add breakpoints in production code without breaking anything. Feel free to merge!
Thank you for "playing" with fork_break, your comments matter a lot to us.
I'll rebase all PRs shortly and hopefully soon I'll push a new version to rubygems.
Excellent! Being able to set ignored breakpoints in production code was of course the intention all along!
Hi, I'm having trouble using the
include ForkBreak::Breakpoints
mechanism in any Rails model or plain class.Using 0.1.3.
Any clue?
Cheers - Victor