Created
February 23, 2018 10:05
-
-
Save tkfm-yamaguchi/140a8453d71fc516eba50eaea8bb27cb to your computer and use it in GitHub Desktop.
Launch webrick as non-blocking http server
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
require 'webrick' | |
require 'open3' | |
server = WEBrick::HTTPServer.new(:DocumentRoot => './', Port: 9999, ServerType: Thread) | |
server.start | |
sleep 3 | |
result = Open3.capture2e('curl http://localhost:9999/index.html') | |
p result | |
server.shutdown |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment