Skip to content

Commit

Permalink
Move skipping logic out of Config class
Browse files Browse the repository at this point in the history
  • Loading branch information
st0012 committed Nov 1, 2022
1 parent b5ce120 commit 40b3b31
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
10 changes: 0 additions & 10 deletions lib/debug/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ def self.config
end

def initialize argv
@skip_all = false

if self.class.config
raise 'Can not make multiple configurations in one process'
end
Expand Down Expand Up @@ -94,14 +92,6 @@ def []=(key, val)
set_config(key => val)
end

def skip_all
@skip_all = true
end

def skip?
@skip_all
end

def set_config(**kw)
conf = config.dup
kw.each{|k, v|
Expand Down
2 changes: 1 addition & 1 deletion lib/debug/server_cdp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def run_new_chrome
stderr.close

at_exit{
CONFIG.skip_all
DEBUGGER__.skip_all
FileUtils.rm_rf dir
}

Expand Down
2 changes: 1 addition & 1 deletion lib/debug/server_dap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def self.setup debug_port
end

at_exit do
CONFIG.skip_all
DEBUGGER__.skip_all
FileUtils.rm_rf dir if tempdir
end

Expand Down
10 changes: 10 additions & 0 deletions lib/debug/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ module DEBUGGER__
PresetCommand = Struct.new(:commands, :source, :auto_continue)
class PostmortemError < RuntimeError; end

class << self
def skip_all
@skip_all = true
end

def skip?
@skip_all
end
end

class Session
attr_reader :intercepted_sigint_cmd, :process_group, :subsession_id

Expand Down
2 changes: 1 addition & 1 deletion lib/debug/thread_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module DEBUGGER__
module SkipPathHelper
def skip_path?(path)
!path ||
CONFIG.skip? ||
DEBUGGER__.skip? ||
ThreadClient.current.management? ||
skip_internal_path?(path) ||
skip_config_skip_path?(path)
Expand Down

0 comments on commit 40b3b31

Please sign in to comment.