Created
December 8, 2014 13:07
-
-
Save reu/fb29f2c4f79bb1df6892 to your computer and use it in GitHub Desktop.
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 "webrick" | |
unless ARGV[0] | |
STDERR.puts "Usage: cgiup [PATH TO CGI SCRIPT]" | |
exit 1 | |
end | |
cgi_script = File.expand_path(ARGV[0]) | |
unless File.exists?(cgi_script) | |
STDERR.puts "CGI Script: #{cgi_script} Not Found" | |
exit 1 | |
end | |
server = WEBrick::HTTPServer.new(:Port => 2000) | |
server.mount("/", WEBrick::HTTPServlet::CGIHandler, cgi_script) | |
trap("INT"){ server.shutdown } | |
server.start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment