Skip to content

Commit

Permalink
Define the cleanup method to hide the process for only cdp
Browse files Browse the repository at this point in the history
  • Loading branch information
小野 直人 committed Dec 7, 2021
1 parent 01dd6d4 commit 5557fdc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/debug/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,7 @@ def activate session, on_fork: false
DEBUGGER__.warn "ReaderThreadError: #{e}"
pp e.backtrace
ensure
DEBUGGER__.warn "Disconnected."
@sock = nil
@q_msg.close
@q_msg = nil
@q_ans.close
@q_ans = nil
FileUtils.rm_rf @user_data_dir if @user_data_dir
cleanup_reader
end # accept

rescue Terminate
Expand Down Expand Up @@ -215,6 +209,15 @@ def setup_interrupt
trap(:SIGURG, prev_handler)
end

def cleanup_reader
DEBUGGER__.warn "Disconnected."
@sock = nil
@q_msg.close
@q_msg = nil
@q_ans.close
@q_ans = nil
end

attr_reader :reader_thread

class NoRemoteError < Exception; end
Expand Down
4 changes: 4 additions & 0 deletions lib/debug/server_cdp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,10 @@ def deactivate_bp
@q_ans << 'y'
end

def cleanup_reader
FileUtils.rm_rf @user_data_dir if @user_data_dir
end

## Called by the SESSION thread

def readline prompt
Expand Down

0 comments on commit 5557fdc

Please sign in to comment.