Upgrade to ChildProcess 0.2.4 for LaunchError
This commit is contained in:
parent
7e4d652702
commit
0d2cf4bbe7
|
@ -37,7 +37,7 @@ module Vagrant
|
||||||
# specific driver to instantiate.
|
# specific driver to instantiate.
|
||||||
begin
|
begin
|
||||||
@version = read_version
|
@version = read_version
|
||||||
rescue Subprocess::ProcessFailedToStart
|
rescue Subprocess::LaunchError
|
||||||
# This means that VirtualBox was not found, so we raise this
|
# This means that VirtualBox was not found, so we raise this
|
||||||
# error here.
|
# error here.
|
||||||
raise Errors::VirtualBoxNotDetected
|
raise Errors::VirtualBoxNotDetected
|
||||||
|
|
|
@ -50,16 +50,10 @@ module Vagrant
|
||||||
Dir.chdir(workdir) do
|
Dir.chdir(workdir) do
|
||||||
process.start
|
process.start
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue ChildProcess::LaunchError
|
||||||
if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
|
# Raise our own version of the error so that users of the class
|
||||||
if e.is_a?(NativeException)
|
# don't need to be aware of ChildProcess
|
||||||
# This usually means that the process failed to start, so we
|
raise LaunchError
|
||||||
# raise that error.
|
|
||||||
raise ProcessFailedToStart
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
raise
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Make sure the stdin does not buffer
|
# Make sure the stdin does not buffer
|
||||||
|
@ -95,12 +89,6 @@ module Vagrant
|
||||||
io_name = r == stdout ? :stdout : :stderr
|
io_name = r == stdout ? :stdout : :stderr
|
||||||
@logger.debug("#{io_name}: #{data}")
|
@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
|
io_data[r] += data
|
||||||
yield io_name, data if block_given?
|
yield io_name, data if block_given?
|
||||||
end
|
end
|
||||||
|
@ -195,8 +183,8 @@ module Vagrant
|
||||||
data
|
data
|
||||||
end
|
end
|
||||||
|
|
||||||
# An error which occurs when a process fails to start.
|
# An error which raises when a process fails to start
|
||||||
class ProcessFailedToStart < StandardError; end
|
class LaunchError < StandardError; end
|
||||||
|
|
||||||
# An error which occurs when the process doesn't end within
|
# An error which occurs when the process doesn't end within
|
||||||
# the given timeout.
|
# the given timeout.
|
||||||
|
|
|
@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
||||||
s.rubyforge_project = "vagrant"
|
s.rubyforge_project = "vagrant"
|
||||||
|
|
||||||
s.add_dependency "archive-tar-minitar", "= 0.5.2"
|
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 "erubis", "~> 2.7.0"
|
||||||
s.add_dependency "json", "~> 1.5.1"
|
s.add_dependency "json", "~> 1.5.1"
|
||||||
s.add_dependency "log4r", "~> 1.1.9"
|
s.add_dependency "log4r", "~> 1.1.9"
|
||||||
|
|
Loading…
Reference in New Issue