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