Upgrade to ChildProcess 0.2.4 for LaunchError

This commit is contained in:
Mitchell Hashimoto 2011-12-26 19:55:10 -08:00
parent 7e4d652702
commit 0d2cf4bbe7
3 changed files with 8 additions and 20 deletions

View File

@ -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

View File

@ -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.

View File

@ -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"