Skip to content

Commit

Permalink
Merge pull request #796 from petergoldstein/bugfix/restore_windows_co…
Browse files Browse the repository at this point in the history
…mpatibility

Don't load UNIXSocket on Windows systems
  • Loading branch information
petergoldstein committed Oct 14, 2021
2 parents 3347099 + a325343 commit 7d1d34e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/dalli/socket.rb
@@ -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 7d1d34e

Please sign in to comment.