canvas-lms/bin/byebug-remote

32 lines
494 B
Ruby
Executable File

#!/usr/bin/env ruby
# frozen_string_literal: true
require 'byebug/core'
require 'tmpdir'
def byebug_port_file
File.join(Dir.tmpdir, 'byebug.port')
end
def byebug_port
return unless File.exist?(byebug_port_file)
File.read(byebug_port_file).to_i
end
def connect
begin
while !byebug_port do
puts "Waiting for byebug port..."
sleep 0.5
end
Byebug.start_client('localhost', byebug_port)
rescue Errno::ECONNREFUSED
end
end
while !connect do
sleep 0.5
end