Module: EY::Tea::Server::Mock
- Defined in:
- lib/htttee/server/mock.rb
Defined Under Namespace
Classes: EchoUri, ThinMuxer
Class Method Summary
collapse
Class Method Details
.boot_forking_server ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/htttee/server/mock.rb', line 8
def self.boot_forking_server
o,i = IO.pipe
if pid = fork
at_exit { Process.kill(:SIGTERM, pid) }
i.close
URI.parse(o.read)
else
o.close
process_child(i)
end
end
|
.process_child(i) ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/htttee/server/mock.rb', line 22
def self.process_child(i)
EM.run do
client = Rack::Client.new { run EY::Tea::Server.mock_app }
uri = client.get("/mux-uri").body
i << uri
i.close
end
exit
end
|