Skip to content

Commit

Permalink
Don't load UNIXSocket on Windows systems
Browse files Browse the repository at this point in the history
  • Loading branch information
petergoldstein committed Oct 14, 2021
1 parent 3347099 commit a325343
Showing 1 changed file with 10 additions and 1 deletion.
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

0 comments on commit a325343

Please sign in to comment.