# File lib/librarian/posix.rb, line 85 def run!(command, options = { }) i, o, e = IO.pipe, IO.pipe, IO.pipe pid = fork do $stdin.reopen i[0] $stdout.reopen o[1] $stderr.reopen e[1] [i[1], i[0], o[0], e[0]].each &:close ENV.update options[:env] || { } Dir.chdir options[:chdir].to_s if options[:chdir] exec *command end [i[0], i[1], o[1], e[1]].each &:close Process.waitpid pid $?.success? or CommandFailure.raise! command, $?, e[0].read o[0].read ensure [i, o, e].flatten(1).each{|io| io.close unless io.closed?} end