Make files writable before trying to write

This commit is contained in:
Max Howell 2022-12-20 11:10:33 -05:00
parent 972f0715f4
commit 037a34701c
No known key found for this signature in database
GPG key ID: 741BB84EF5BB9EEC

View file

@ -80,8 +80,15 @@ class Fixer
end
def write
stat = File.stat(@file.filename)
if not stat.writable?
File.chmod(0644, @file.filename)
chmoded = true
end
@file.write!
@changed = true
ensure
File.chmod(stat.mode, @file.filename) if chmoded
end
def links_to_other_tea_libs?