lib/tracksperanto/buffer_io.rb in tracksperanto-2.5.0 vs lib/tracksperanto/buffer_io.rb in tracksperanto-2.6.0
- old
+ new
@@ -46,9 +46,11 @@
private
def replace_with_tempfile
sio = __getobj__
tf = Tempfile.new("tracksperanto-xbuf")
+ tf.set_encoding(Encoding::BINARY) if @rewindable_io.respond_to?(:set_encoding)
+ tf.binmode
tf.write(sio.string)
tf.flush # Needed of we will reopen this file soon from another thread/loop
sio.string = ""
GC.start
__setobj__(tf)
\ No newline at end of file