Created
February 8, 2012 19:50
-
-
Save jbarnette/1772804 to your computer and use it in GitHub Desktop.
This file contains 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
require "bundler/setup" | |
require "rack/streaming_proxy" | |
warn "Sleeping for a bit before starting gimme." | |
sleep 3 | |
warn "Starting gimme." | |
nport = 2727 | |
nenv = ENV.to_hash.merge "PORT" => nport.to_s | |
npid = Process.spawn nenv, "coffee index.coffee", err: :out, out: $stdout | |
sleep 3 | |
warn "Gimme should be started by now." | |
Signal.trap "QUIT" do | |
warn "SIGQUIT received, killing gimme." | |
Process.kill "QUIT", npid | |
end | |
use Rack::StreamingProxy do |req| | |
"http://localhost:#{nport}#{req.path}" | |
end | |
run lambda { |env| | |
[200, { "Content-Type" => "text/plain" }, ["Wut."]] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment