Skip to content

Instantly share code, notes, and snippets.

@maasha
Created October 2, 2014 11:34
Show Gist options
  • Save maasha/8973751f694c24f375ff to your computer and use it in GitHub Desktop.
Save maasha/8973751f694c24f375ff to your computer and use it in GitHub Desktop.
def run_thread
input = @options[:input] || []
output = @options[:output]
threads = []
@commands[1 .. -1].reverse.each do |command|
io_read, io_write = BioPieces::Stream.pipe
threads << Thread.new(command, io_read, output) do |cmd, iin, iout|
cmd.run(iin, iout)
end
output = io_write
end
@commands.first.run(input, output)
threads.reverse.each { |t| t.join }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment