aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martínez <jjm@usebox.net>2021-06-03 06:17:00 +0100
committerGitHub <noreply@github.com>2021-06-03 06:17:00 +0100
commit1322b9688ca32b5f1ed276df8bc1d9b89bab83f9 (patch)
tree6613ff9dca3e8380cf222c566601d7a6991301de
parent61bc09a25e83193c68057341bfb33150785b4bcd (diff)
parent69b4102c996f1793dbc7280924ae023281f94d30 (diff)
downloadubox-msx-lib-1322b9688ca32b5f1ed276df8bc1d9b89bab83f9.tar.gz
ubox-msx-lib-1322b9688ca32b5f1ed276df8bc1d9b89bab83f9.zip
Merge pull request #4 from pvmm/pullrequest
map.py: remove generated files on error
-rwxr-xr-xtools/map.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/map.py b/tools/map.py
index c2e2212..53c98b7 100755
--- a/tools/map.py
+++ b/tools/map.py
@@ -318,6 +318,7 @@ def main():
if args.bin:
for i, block in enumerate(out):
filename = path.join(args.dir, "%s%02d.bin" % (args.id, i))
+ remove_list.append(filename)
with open(filename, "wb") as fd:
if i in empty:
fd.write(struct.pack("<B", 0))
@@ -379,9 +380,16 @@ def main():
if __name__ == "__main__":
+ remove_list = []
+
try:
main()
except Exception as ex:
print("FATAL: %s\n***" % ex, file=sys.stderr)
- traceback.print_exc(ex)
+ traceback.print_exc()
+
+ for filename in remove_list:
+ if os.path.exists(filename):
+ os.unlink(filename)
+
sys.exit(1)