From cf115c10b1cacaaa2364ed9ca58a694586a3dd32 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 13 Aug 2011 18:54:32 -0700 Subject: [PATCH] Fix errno not defined [closes GH-465] --- lib/vagrant/util/safe_exec.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/vagrant/util/safe_exec.rb b/lib/vagrant/util/safe_exec.rb index 7ebafac7e..9a24a8b1f 100644 --- a/lib/vagrant/util/safe_exec.rb +++ b/lib/vagrant/util/safe_exec.rb @@ -8,13 +8,20 @@ module Vagrant # forking. module SafeExec def safe_exec(command) + # Create a list of things to rescue from. Since this is OS + # specific, we need to do some defined? checks here to make + # sure they exist. + rescue_from = [] + rescue_from << Errno::EOPNOTSUPP if defined?(Errno::EOPNOTSUPP) + rescue_from << Errno::E045 if defined?(Errno::E045) + fork_instead = false begin pid = nil pid = fork if fork_instead Kernel.exec(command) if pid.nil? Process.wait(pid) if pid - rescue Errno::E045 + rescue *rescue_from # We retried already, raise the issue and be done raise if fork_instead