# File lib/librarian/posix.rb, line 106 def run!(command, options = { }) i, o, e = IO.pipe, IO.pipe, IO.pipe opts = {:in => i[0], :out => o[1], :err => e[1]} opts[:chdir] = options[:chdir].to_s if options[:chdir] command = command.dup command.unshift options[:env] || { } command.push opts pid = Process.spawn(*command) [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