diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2014-10-15 09:04:05 -0700 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2014-10-22 13:03:24 -0700 |
commit | 61139f1a909f2085b696071c3ef47c7b341094f0 (patch) | |
tree | 3eee3c1494a10e90923b39ae9bd52498dc404cd0 | |
parent | 2572f6a15a6a807bfb67ca1d65efdecc537642f4 (diff) | |
download | chef-61139f1a909f2085b696071c3ef47c7b341094f0.tar.gz |
Guard windows includes
-rw-r--r-- | lib/chef/logging/windows_eventlog.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/chef/logging/windows_eventlog.rb b/lib/chef/logging/windows_eventlog.rb index 3fffd77138..3f20e90dc1 100644 --- a/lib/chef/logging/windows_eventlog.rb +++ b/lib/chef/logging/windows_eventlog.rb @@ -1,11 +1,15 @@ -[:INFINITE, :WAIT_FAILED, :FORMAT_MESSAGE_IGNORE_INSERTS, :ERROR_INSUFFICIENT_BUFFER].each do |c| - # These are redefined in 'win32/eventlog' - Windows::Constants.send(:remove_const, c) -end - require 'chef/logging/eventlog' -require 'win32/eventlog' -include Win32 +require 'chef/platform/query_helpers' + +if Chef::Platform::windows? + [:INFINITE, :WAIT_FAILED, :FORMAT_MESSAGE_IGNORE_INSERTS, :ERROR_INSUFFICIENT_BUFFER].each do |c| + # These are redefined in 'win32/eventlog' + Windows::Constants.send(:remove_const, c) + end + + require 'win32/eventlog' + include Win32 +end class Chef module Logging |