Open gzip file in binary mode

This commit is contained in:
Nobuyoshi Nakada 2021-02-03 17:32:41 +09:00
parent 583f364f71
commit d05a268adc
No known key found for this signature in database
GPG Key ID: 7CD2805BFA3770C6

View File

@ -516,14 +516,14 @@ if defined? Zlib
gz.close gz.close
results = [] results = []
t = File.open(t.path) t = File.open(t.path, 'rb')
Zlib::GzipReader.zcat(t) do |str| Zlib::GzipReader.zcat(t) do |str|
results << str results << str
end end
assert_equal(["foo", "bar"], results) assert_equal(["foo", "bar"], results)
t.close t.close
t = File.open(t.path) t = File.open(t.path, 'rb')
assert_equal("foobar", Zlib::GzipReader.zcat(t)) assert_equal("foobar", Zlib::GzipReader.zcat(t))
t.close t.close
} }