Created
September 25, 2014 19:22
-
-
Save outoftime/3dc03a09798631d9dc5d to your computer and use it in GitHub Desktop.
Passenger standalone with debugger and pry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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