Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't load UNIXSocket on Windows systems #796

Merged
merged 1 commit into from
Oct 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/dalli/socket.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require 'openssl'
require 'rbconfig'

module Dalli
module Socket
Expand Down Expand Up @@ -77,8 +78,16 @@ def self.open(host, port, server, options = {})
end
end
end
end

class UNIX < UNIXSocket
if RbConfig::CONFIG['host_os'] =~ /mingw|mswin/
class Dalli::Socket::UNIX
def initialize(*args)
raise Dalli::DalliError, 'Unix sockets are not supported on Windows platform.'
end
end
else
class Dalli::Socket::UNIX < UNIXSocket
include Dalli::Socket::InstanceMethods
attr_accessor :options, :server

Expand Down