Skip to content

Instantly share code, notes, and snippets.

@tatat
Created July 31, 2013 09:51
Show Gist options
  • Save tatat/6120810 to your computer and use it in GitHub Desktop.
Save tatat/6120810 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rack'
require 'net/http'
require 'uri'
pid = fork do
Rack::Handler::WEBrick.run ->(env){ [200, {'Content-Type' => 'plain/text'}, ['Nyan!']] }, Port: 9000
end
sleep 1
begin
puts Net::HTTP.get(URI.parse('http://localhost:9000/'))
ensure
Process.kill 'KILL', pid
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment