Skip to content

Commit

Permalink
Merge pull request #80 from k0kubun/byebug-stop
Browse files Browse the repository at this point in the history
Stop Byebug after continue
  • Loading branch information
David Rodríguez committed Nov 5, 2015
2 parents 97394fe + 30ae7cc commit a9c4d4b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/pry-byebug.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
require 'pry-byebug/base'
require 'pry-byebug/pry_ext'
require 'pry-byebug/commands'
require 'pry-byebug/control_d_handler'
1 change: 1 addition & 0 deletions lib/pry-byebug/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
require 'pry-byebug/commands/down'
require 'pry-byebug/commands/frame'
require 'pry-byebug/commands/breakpoint'
require 'pry-byebug/commands/exit_all'
2 changes: 2 additions & 0 deletions lib/pry-byebug/commands/continue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def process
breakpoints.add_file(current_file, args.first.to_i) if args.first

breakout_navigation :continue
ensure
Byebug.stop if Byebug.stoppable?
end
end
end
Expand Down
14 changes: 14 additions & 0 deletions lib/pry-byebug/commands/exit_all.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module PryByebug
#
# Exit pry REPL with Byebug.stop
#
class ExitAllCommand < Pry::Command::ExitAll
def process
super
ensure
Byebug.stop if Byebug.stoppable?
end
end
end

Pry::Commands.add_command(PryByebug::ExitAllCommand)
7 changes: 7 additions & 0 deletions lib/pry-byebug/control_d_handler.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
original_handler = Pry.config.control_d_handler

Pry.config.control_d_handler = proc do |eval_string, _pry_|
Byebug.stop if Byebug.stoppable?

original_handler.call(eval_string, _pry_)
end

0 comments on commit a9c4d4b

Please sign in to comment.