10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/vagrant/util/safe_exec.rb', line 10
def safe_exec(command, *args)
rescue_from = []
rescue_from << Errno::EOPNOTSUPP if defined?(Errno::EOPNOTSUPP)
rescue_from << Errno::E045 if defined?(Errno::E045)
rescue_from << SystemCallError
fork_instead = false
begin
pid = nil
pid = fork if fork_instead
Kernel.exec(command, *args) if pid.nil?
Process.wait(pid) if pid
rescue *rescue_from
raise if fork_instead
fork_instead = true
retry
end
end
|