K
Kevin M
When I run a ruby script that uses webrick, it seems to hang on exit.
I'm using ruby 1.8.2 on Windows XP. (I don't remember having this
sort of problem using linux, but I don't have a machine here to verify
that.)
For example, if I run the following:
require 'webrick'
server = WEBrick::HTTPServer.new(
ort => 8081,
ocumentRoot => '.'
)
['INT', 'TERM'].each {|signal| trap(signal) {
puts "got #{signal}, shutting down..."
server.shutdown
puts "OK"
}}
server.start
This will start up fine, but on hitting CTRL-C it'll display both
'puts', and then hang. I have to kill the process with task manager.
Any thoughts as to what I'm doing wrong?
Cheers,
Kevin
I'm using ruby 1.8.2 on Windows XP. (I don't remember having this
sort of problem using linux, but I don't have a machine here to verify
that.)
For example, if I run the following:
require 'webrick'
server = WEBrick::HTTPServer.new(
ort => 8081,
ocumentRoot => '.'
)
['INT', 'TERM'].each {|signal| trap(signal) {
puts "got #{signal}, shutting down..."
server.shutdown
puts "OK"
}}
server.start
This will start up fine, but on hitting CTRL-C it'll display both
'puts', and then hang. I have to kill the process with task manager.
Any thoughts as to what I'm doing wrong?
Cheers,
Kevin