digital-fabric / polyphony

Fine-grained concurrency for Ruby
https://www.rubydoc.info/gems/polyphony
MIT License
655 stars 17 forks source link

Add IO#tee_from method in backend #81

Closed noteflakes closed 2 years ago

noteflakes commented 2 years ago

An basic implementation of the tee command, based on this:

require 'polyphony'

file_path = ARGV[0]

File.open(file_path, 'w+') do |f|
  len = STDOUT.tee_from(STDIN, 2**16)
  f.splice_from(STDIN, len)
end