class Chef::ReservedNames::Win32::Handle
Attributes
Public Class Methods
Source
# File lib/chef/win32/handle.rb, line 40 def self.close_handle(handle) # According to http://msdn.microsoft.com/en-us/library/windows/desktop/ms683179(v=vs.85).aspx, it is not necessary # to close the pseudo handle returned by the GetCurrentProcess function. The docs also say that it doesn't hurt to call # CloseHandle on it. However, doing so from inside of Ruby always seems to produce an invalid handle error. # The recommendation is to use GetCurrentProcess instead of the const (HANDLE)-1, to ensure we're making the correct comparison. return if handle == GetCurrentProcess() unless CloseHandle(handle) Chef::ReservedNames::Win32::Error.raise! end end
Source
# File lib/chef/win32/handle.rb, line 36 def self.close_handle_finalizer(handle) proc { close_handle(handle) } end
Source
# File lib/chef/win32/handle.rb, line 29 def initialize(handle) @handle = handle ObjectSpace.define_finalizer(self, Handle.close_handle_finalizer(handle)) end