# File lib/yui/compressor.rb, line 65 def compress(stream_or_string) streamify(stream_or_string) do |stream| output = true status = POpen4.popen4(command, "b") do |stdout, stderr, stdin, pid| begin stdin.binmode transfer(stream, stdin) if block_given? yield stdout else output = stdout.read end rescue Exception => e raise RuntimeError, "compression failed" end end if status.exitstatus.zero? output else raise RuntimeError, "compression failed" end end end