-
Notifications
You must be signed in to change notification settings - Fork 419
Closed
Description
Ruby is continuing its path of requiring more gems to be specified. win32ole
is next on the list (among others) and will start warning in Ruby 3.4: ruby/ruby@f365bef
Usage is here, to get the number of cores on windows:
concurrent-ruby/lib/concurrent-ruby/concurrent/utility/processor_counter.rb
Lines 71 to 75 in b5e090b
require 'win32ole' | |
result_set = WIN32OLE.connect("winmgmts://").ExecQuery( | |
"select NumberOfCores from Win32_Processor") | |
result_set.to_enum.collect(&:NumberOfCores).reduce(:+) | |
else |
Something like the following may be a suitable replacement:
IO.popen("wmic cpu get NumberOfCores", &:read).scan(/\d+/).map(&:to_i).reduce(:+)
Output of that command:
NumberOfCores \n\n4 \n\n\n\n
I have also openend the same report on parallel
at grosser/parallel#345 if you are interested. Both implementations for this are basically the same.
Metadata
Metadata
Assignees
Labels
No labels