Skip to content

Instantly share code, notes, and snippets.

@outoftime
Created September 25, 2014 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save outoftime/3dc03a09798631d9dc5d to your computer and use it in GitHub Desktop.
Save outoftime/3dc03a09798631d9dc5d to your computer and use it in GitHub Desktop.
Passenger standalone with debugger and pry
#!/usr/bin/env ruby
require 'bundler'
Bundler.setup(:default, :development)
require 'rack-debug/debugger'
require 'pry-remote'
system('rm', '-fv', 'tmp/rack-debug.*')
fork { exec 'bundle', 'exec', 'passenger', 'start' }
fork do
$0 = 'passenger pry'
loop { PryRemote::CLI.new(%w(--wait)).run }
end
fork do
$0 = 'passenger debugger'
loop do
begin
socket_path = File.expand_path('../../tmp/rack-debug', __FILE__)
Debugger.start_unix_socket_client(socket_path)
rescue Errno::ECONNREFUSED, Errno::ENOENT => e
sleep(1)
retry
end
end
end
trap('INT') { Process.waitall; exit }
Process.waitall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment