2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 19:28:26 +08:00

compiler: fix ARTIQ_DUMP_*.

This commit is contained in:
whitequark 2016-02-24 21:43:46 +00:00
parent 652c2a185f
commit da31d29897

View File

@ -46,11 +46,12 @@ class RunTool:
def _dump(target, kind, suffix, content): def _dump(target, kind, suffix, content):
if target is not None: if target is not None:
print("====== {} DUMP ======".format(kind.upper()), file=sys.stderr) print("====== {} DUMP ======".format(kind.upper()), file=sys.stderr)
content_bytes = bytes(content(), 'utf-8')
if target == "": if target == "":
file = tempfile.NamedTemporaryFile(suffix, delete=False) file = tempfile.NamedTemporaryFile(suffix=suffix, delete=False)
else: else:
file = open(target + suffix, "wb") file = open(target + suffix, "wb")
file.write(content()) file.write(content_bytes)
file.close() file.close()
print("{} dumped as {}".format(kind, file.name), file=sys.stderr) print("{} dumped as {}".format(kind, file.name), file=sys.stderr)