lib/cocaine/command_line/runners/process_runner.rb in cocaine-0.5.7 vs lib/cocaine/command_line/runners/process_runner.rb in cocaine-0.5.8
- old
+ new
@@ -14,17 +14,15 @@
def supported?
self.class.supported?
end
def call(command, env = {}, options = {})
- input, output = IO.pipe
- options[:out] = output
- pid = spawn(env, command, options)
- output.close
- result = input.read
- waitpid(pid)
- input.close
- result
+ pipe = MultiPipe.new
+ pid = spawn(env, command, options.merge(pipe.pipe_options))
+ pipe.read_and_then do
+ waitpid(pid)
+ end
+ pipe.output
end
private
def spawn(*args)