Skip to content

Commit

Permalink
Add support for Windows hosts
Browse files Browse the repository at this point in the history
This uses the WMIC command line available starting with Windows Vista/Server 2003 to query for CPU cores and memory.
  • Loading branch information
mbrodala committed Feb 16, 2015
1 parent 1937770 commit 828271e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/vagrant/faster/action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ def optimal_settings
elsif host =~ /linux/
cpus = `nproc`.to_i
mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024
elsif host =~ /mswin|mingw|cygwin/
cpus = `wmic cpu Get NumberOfCores`.split[1].to_i
mem = `wmic computersystem Get TotalPhysicalMemory`.split[1].to_i / 1024 / 1024
end

# Give VM 1/4 system memory & access to half of cpu cores on the host
Expand Down

0 comments on commit 828271e

Please sign in to comment.