From 828271e63026916dd7d3fcd889696a3a91999d74 Mon Sep 17 00:00:00 2001 From: Mathias Brodala Date: Mon, 16 Feb 2015 10:36:28 +0100 Subject: [PATCH] Add support for Windows hosts This uses the WMIC command line available starting with Windows Vista/Server 2003 to query for CPU cores and memory. --- lib/vagrant/faster/action.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/vagrant/faster/action.rb b/lib/vagrant/faster/action.rb index 0d5ecd2..7a9ceab 100644 --- a/lib/vagrant/faster/action.rb +++ b/lib/vagrant/faster/action.rb @@ -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