aboutsummaryrefslogtreecommitdiffstats
path: root/pyGHDL
diff options
context:
space:
mode:
authorumarcor <unai.martinezcorral@ehu.eus>2021-06-18 20:29:24 +0200
committerumarcor <unai.martinezcorral@ehu.eus>2021-06-19 13:39:35 +0200
commite72d21499659f1bb4b641b9a83698354eb170eef (patch)
tree94c921d1dd2bee8cdc75af366cf23a4c116b8edb /pyGHDL
parent47e9f0bfdd0b0c0a71a011ce958a01c39d3ba949 (diff)
downloadghdl-e72d21499659f1bb4b641b9a83698354eb170eef.tar.gz
ghdl-e72d21499659f1bb4b641b9a83698354eb170eef.tar.bz2
ghdl-e72d21499659f1bb4b641b9a83698354eb170eef.zip
pyGHDL/cli/DOM: if an exception arises return non zero exit code and do not pretty print
Diffstat (limited to 'pyGHDL')
-rwxr-xr-xpyGHDL/cli/DOM.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/pyGHDL/cli/DOM.py b/pyGHDL/cli/DOM.py
index abf1f0af8..6bd6c8a7e 100755
--- a/pyGHDL/cli/DOM.py
+++ b/pyGHDL/cli/DOM.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
from sys import argv
+from sys import exit as sysexit
from pathlib import Path
@@ -38,23 +39,25 @@ class Application:
print("\n".join(buffer))
-def main():
- items = argv[1:]
+def main(items):
+ _exitcode = 0
+
if len(items) < 1:
print("Please, provide the files to be analyzed as CLI arguments.")
print("Using <testsuite/pyunit/SimpleEntity.vhdl> for demo purposes.\n")
items = ["testsuite/pyunit/SimpleEntity.vhdl"]
for item in items:
- print("ยท", item)
try:
app = Application()
app.addFile(Path(item), "default_lib")
+ app.prettyPrint()
except GHDLBaseException as ex:
print(ex)
+ _exitcode = 1
- app.prettyPrint()
+ return _exitcode
if __name__ == "__main__":
- main()
+ sysexit(main(argv[1:]))