lukeredpath/mimic — pull request #5 by ahamid (2012-02-06 21:19:34+00:00)
Title: fix interrupt handling

I had to make the following changes otherwise Ctrl-C/interrupt was not handled appropriately, at least on Fedora Linux. Ctrl-C fires the INT signal, not EXIT (that occurs when the process actually exits), also improved previous interrupt command handling.

sample case:

````

#!/usr/bin/env ruby
require 'mimic'
# otherwise: mimic.rb:89:in `rescue in listening?': uninitialized constant Mimic::Server::SocketError
require 'socket'

Mimic.mimic(:port => 11988, :fork => false) do
get("/some/other/path").returning("Redirecting...", 301, {"Location" => "somewhere else"})
get("/some/path").returning("Hello World", 200)
post("/some/path").returning("Created!", 201)
end
````

existing tests still pass