forked from M-Labs/artiq
1
0
Fork 0

compiler: fix ARTIQ_DUMP_ELF.

This commit is contained in:
whitequark 2016-03-29 13:02:14 +00:00
parent a9489246a4
commit f6b391bb4e
1 changed files with 4 additions and 2 deletions

View File

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