mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Puma can now run on windows
This commit is contained in:
parent
fc0aebd3c7
commit
fb40724448
2 changed files with 45 additions and 6 deletions
|
@ -419,14 +419,22 @@ module Puma
|
|||
@status = status
|
||||
end
|
||||
|
||||
Signal.trap "SIGUSR2" do
|
||||
@restart = true
|
||||
server.begin_restart
|
||||
begin
|
||||
Signal.trap "SIGUSR2" do
|
||||
@restart = true
|
||||
server.begin_restart
|
||||
end
|
||||
rescue Exception
|
||||
log "*** Sorry signal SIGUSR2 not implemented, restart feature disabled!"
|
||||
end
|
||||
|
||||
Signal.trap "SIGTERM" do
|
||||
log " - Gracefully stopping, waiting for requests to finish"
|
||||
server.stop false
|
||||
begin
|
||||
Signal.trap "SIGTERM" do
|
||||
log " - Gracefully stopping, waiting for requests to finish"
|
||||
server.stop false
|
||||
end
|
||||
rescue Exception
|
||||
log "*** Sorry signal SIGTERM not implemented, gracefully stopping feature disabled!"
|
||||
end
|
||||
|
||||
log "Use Ctrl-C to stop"
|
||||
|
|
|
@ -28,6 +28,37 @@ class TestCLI < Test::Unit::TestCase
|
|||
assert_equal File.read(@tmp_path).strip.to_i, Process.pid
|
||||
end
|
||||
|
||||
def test_control_for_tcp
|
||||
url = "tcp://127.0.0.1:9877/"
|
||||
sin = StringIO.new
|
||||
sout = StringIO.new
|
||||
cli = Puma::CLI.new ["-b", "tcp://127.0.0.1:9876",
|
||||
"--control", url,
|
||||
"--control-token", "",
|
||||
"test/lobster.ru"], sin, sout
|
||||
cli.parse_options
|
||||
|
||||
thread_exception = nil
|
||||
t = Thread.new do
|
||||
begin
|
||||
cli.run
|
||||
rescue Exception => e
|
||||
thread_exception = e
|
||||
end
|
||||
end
|
||||
|
||||
sleep 1
|
||||
|
||||
s = TCPSocket.new "127.0.0.1", 9877
|
||||
s << "GET /stats HTTP/1.0\r\n\r\n"
|
||||
body = s.read
|
||||
assert_equal '{ "backlog": 0, "running": 0 }', body.split("\r\n").last
|
||||
|
||||
cli.stop
|
||||
t.join
|
||||
assert_equal nil, thread_exception
|
||||
end
|
||||
|
||||
unless defined?(JRUBY_VERSION) || RbConfig::CONFIG["host_os"] =~ /mingw|mswin/
|
||||
def test_control
|
||||
url = "unix://#{@tmp_path}"
|
||||
|
|
Loading…
Add table
Reference in a new issue