Skip to content

Instantly share code, notes, and snippets.

@ealdent
Created March 9, 2011 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ealdent/862518 to your computer and use it in GitHub Desktop.
Save ealdent/862518 to your computer and use it in GitHub Desktop.
Hack to fix error in resque when a 404 is returned where it shouldn't be
def port_open?(check_url = nil)
begin
check_url ||= url
options[:no_proxy] ? open(check_url, :proxy => nil) : open(check_url)
false
rescue Errno::ECONNREFUSED => e
true
rescue Errno::EPERM => e
# catches the "Operation not permitted" under Cygwin
true
rescue
true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment