Bug 1236111 - part 2: fix mozbuild to use the file mode modifiers specified for opening when writing a FileAvoidWrite, r=gps,nalexander

--HG--
extra : commitid : J6mVFwKgMQh
extra : rebase_source : 8a8b0ba2c21cf561af8dd667e387106869a65124
This commit is contained in:
Gijs Kruitbosch 2016-01-05 14:46:24 +00:00
Родитель 7e16352e77
Коммит fbc8f9a32e
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -166,7 +166,12 @@ class FileAvoidWrite(BytesIO):
existing.close()
ensureParentDir(self.name)
with open(self.name, 'w') as file:
# Maintain 'b' if specified. 'U' only applies to modes starting with
# 'r', so it is dropped.
writemode = 'w'
if 'b' in self.mode:
writemode += 'b'
with open(self.name, writemode) as file:
file.write(buf)
if self._capture_diff: