inreplace: Open the file as binary
Closes Homebrew/homebrew#22628. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
parent
907ac79606
commit
91e6c993f8
@ -2,7 +2,7 @@ module Utils
|
||||
module Inreplace
|
||||
def inreplace paths, before=nil, after=nil
|
||||
Array(paths).each do |path|
|
||||
f = File.open(path, 'r')
|
||||
f = File.open(path, 'rb')
|
||||
s = f.read
|
||||
|
||||
if before.nil? && after.nil?
|
||||
@ -17,7 +17,7 @@ module Utils
|
||||
end
|
||||
end
|
||||
|
||||
f.reopen(path, 'w').write(s)
|
||||
f.reopen(path, 'wb').write(s)
|
||||
f.close
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user