diff --git a/lib/vagrant/driver/virtualbox.rb b/lib/vagrant/driver/virtualbox.rb index c4199cff6..c35cf6303 100644 --- a/lib/vagrant/driver/virtualbox.rb +++ b/lib/vagrant/driver/virtualbox.rb @@ -37,7 +37,7 @@ module Vagrant # specific driver to instantiate. begin @version = read_version - rescue Subprocess::ProcessFailedToStart + rescue Subprocess::LaunchError # This means that VirtualBox was not found, so we raise this # error here. raise Errors::VirtualBoxNotDetected diff --git a/lib/vagrant/util/subprocess.rb b/lib/vagrant/util/subprocess.rb index 52b5f291d..03bb23113 100644 --- a/lib/vagrant/util/subprocess.rb +++ b/lib/vagrant/util/subprocess.rb @@ -50,16 +50,10 @@ module Vagrant Dir.chdir(workdir) do process.start end - rescue Exception => e - if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby" - if e.is_a?(NativeException) - # This usually means that the process failed to start, so we - # raise that error. - raise ProcessFailedToStart - end - end - - raise + rescue ChildProcess::LaunchError + # Raise our own version of the error so that users of the class + # don't need to be aware of ChildProcess + raise LaunchError end # Make sure the stdin does not buffer @@ -95,12 +89,6 @@ module Vagrant io_name = r == stdout ? :stdout : :stderr @logger.debug("#{io_name}: #{data}") - if io_name == :stderr && io_data[r] == "" && data =~ /Errno::ENOENT/ - # This is how we detect that a process failed to start on - # Linux. Hacky, but it works fairly well. - raise ProcessFailedToStart - end - io_data[r] += data yield io_name, data if block_given? end @@ -195,8 +183,8 @@ module Vagrant data end - # An error which occurs when a process fails to start. - class ProcessFailedToStart < StandardError; end + # An error which raises when a process fails to start + class LaunchError < StandardError; end # An error which occurs when the process doesn't end within # the given timeout. diff --git a/vagrant.gemspec b/vagrant.gemspec index a6bcd5908..c0fd65085 100644 --- a/vagrant.gemspec +++ b/vagrant.gemspec @@ -15,7 +15,7 @@ Gem::Specification.new do |s| s.rubyforge_project = "vagrant" s.add_dependency "archive-tar-minitar", "= 0.5.2" - s.add_dependency "childprocess", "~> 0.2.3" + s.add_dependency "childprocess", "~> 0.2.4" s.add_dependency "erubis", "~> 2.7.0" s.add_dependency "json", "~> 1.5.1" s.add_dependency "log4r", "~> 1.1.9"