From c75ec0901438f52b613eecfafc894dcd905cce51 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 30 Jan 2013 21:29:04 -0800 Subject: [PATCH] Lower IO.select timeouts to improve subprocess speeds We were getting bit if the process exited while we were doing an IO.select because it would then wait the full timeout. --- lib/vagrant/util/subprocess.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/vagrant/util/subprocess.rb b/lib/vagrant/util/subprocess.rb index 5c608e210..7fb6499c0 100644 --- a/lib/vagrant/util/subprocess.rb +++ b/lib/vagrant/util/subprocess.rb @@ -101,7 +101,7 @@ module Vagrant @logger.debug("Selecting on IO") while true writers = notify_stdin ? [process.io.stdin] : [] - results = IO.select([stdout, stderr], writers, nil, timeout || 5) + results = IO.select([stdout, stderr], writers, nil, timeout || 0.1) results ||= [] readers = results[0] writers = results[1] @@ -199,7 +199,7 @@ module Vagrant # We have to do this since `readpartial` will actually block # until data is available, which can cause blocking forever # in some cases. - results = IO.select([io], nil, nil, 1) + results = IO.select([io], nil, nil, 0.1) break if !results || results[0].empty? # Read!