From fe5b455fd0d8e95d71b3e1585666681e4deda0e2 Mon Sep 17 00:00:00 2001 From: Joe Heffer <60133133+Joe-Heffer-Shef@users.noreply.github.com> Date: Mon, 25 Nov 2024 09:16:54 +0000 Subject: [PATCH] Add exit code for errors See issue https://github.com/priv-kweihmann/systemdlint/issues/73 --- systemdlint/systemdlint/__main__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/systemdlint/systemdlint/__main__.py b/systemdlint/systemdlint/__main__.py index de85d29d..5ec34015 100644 --- a/systemdlint/systemdlint/__main__.py +++ b/systemdlint/systemdlint/__main__.py @@ -1,3 +1,5 @@ +import sys + from systemdlint.cls.parser import Parser from systemdlint.cls.runargs import ArgParser from systemdlint.conf.getTests import getTests @@ -22,8 +24,14 @@ def main(): _out.write(str(item) + "\n") if isinstance(runargs.output, str): _out.close() + + # Set non-zero exit status code + if _errors: + sys.exit(1) + else: getTests(runargs.files[0]) + if __name__ == '__main__': main()