mibuild/tools/write_to_file: use context manager
This commit is contained in:
parent
90c5512b25
commit
8ce683964a
|
@ -19,9 +19,8 @@ def write_to_file(filename, contents, force_unix=False):
|
||||||
newline = None
|
newline = None
|
||||||
if force_unix:
|
if force_unix:
|
||||||
newline = "\n"
|
newline = "\n"
|
||||||
f = open(filename, "w", newline=newline)
|
with open(filename, "w", newline=newline) as f:
|
||||||
f.write(contents)
|
f.write(contents)
|
||||||
f.close()
|
|
||||||
|
|
||||||
def arch_bits():
|
def arch_bits():
|
||||||
return struct.calcsize("P")*8
|
return struct.calcsize("P")*8
|
||||||
|
|
Loading…
Reference in New Issue