Bug #2655
closedwin32OLE processes lose their connection?
Description
=begin
The following code works in 1.8.6, not in 1.9.x...
require 'win32ole'
wmi = WIN32OLE.connect("winmgmts://")
processes = wmi.ExecQuery("select * from win32_process")
proc = nil
t = []
processes.each {|process|
t << Thread.new { sleep 0.1
process.setPriority 32
}
}
t.each{|t| t.join}
error is:
E:\dev\ruby\windows_ionice\bin>ruby -v bad.rb
ruby 1.9.2dev (2010-01-25 trunk 26409) [i386-mingw32]
bad.rb:12: warning: shadowing outer local variable - t
bad.rb:8:in method_missing': unknown property or method:
setPriority' (WIN32OLERuntimeError)
HRESULT error code:0x80020006
Unknown name.
from bad.rb:8:in block (2 levels) in <main>' from E:/installs/ruby_trunk_installed/lib/ruby/1.9.1/win32ole.rb:13:in
call'
from E:/installs/ruby_trunk_installed/lib/ruby/1.9.1/win32ole.rb:13:in `block in initialize'
=end