summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/logging/windows_eventlog.rb18
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