summaryrefslogtreecommitdiff
path: root/lib/chef/mixin/windows_architecture_helper.rb
diff options
context:
space:
mode:
authoradamedx <adamed@getchef.com>2014-06-15 08:00:09 -0700
committeradamedx <adamed@getchef.com>2014-06-20 22:00:28 -0700
commit688860f60bb605f204f38bdedd2129969063437c (patch)
tree651367080bd5732ac3e1f5e225f93e96a6594e46 /lib/chef/mixin/windows_architecture_helper.rb
parent47c8fced2fe14e39b4f8990db11556351f766bba (diff)
downloadchef-688860f60bb605f204f38bdedd2129969063437c.tar.gz
Restore check for Windows platform in windows_architecture_helper to fix spec break on non-Windows
Diffstat (limited to 'lib/chef/mixin/windows_architecture_helper.rb')
-rw-r--r--lib/chef/mixin/windows_architecture_helper.rb24
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/chef/mixin/windows_architecture_helper.rb b/lib/chef/mixin/windows_architecture_helper.rb
index 038d822989..edcd596341 100644
--- a/lib/chef/mixin/windows_architecture_helper.rb
+++ b/lib/chef/mixin/windows_architecture_helper.rb
@@ -59,16 +59,20 @@ class Chef
end
def is_i386_process_on_x86_64_windows?
- is_64_bit_process_result = FFI::MemoryPointer.new(:int)
-
- # The return value of IsWow64Process is nonzero value if the API call succeeds.
- # The result data are returned in the last parameter, not the return value.
- call_succeeded = IsWow64Process(GetCurrentProcess(), is_64_bit_process_result)
-
- # The result is nonzero if IsWow64Process's calling process, in the case here
- # this process, is running under WOW64, i.e. the result is nonzero if this
- # process is 32-bit (aka :i386).
- result = (call_succeeded != 0) && (is_64_bit_process_result.get_int(0) != 0)
+ if Chef::Platform.windows?
+ is_64_bit_process_result = FFI::MemoryPointer.new(:int)
+
+ # The return value of IsWow64Process is nonzero value if the API call succeeds.
+ # The result data are returned in the last parameter, not the return value.
+ call_succeeded = IsWow64Process(GetCurrentProcess(), is_64_bit_process_result)
+
+ # The result is nonzero if IsWow64Process's calling process, in the case here
+ # this process, is running under WOW64, i.e. the result is nonzero if this
+ # process is 32-bit (aka :i386).
+ result = (call_succeeded != 0) && (is_64_bit_process_result.get_int(0) != 0)
+ else
+ false
+ end
end
def disable_wow64_file_redirection( node )