From 71c09b9c04d4f33e374e0f0422c4535fe9bc608b Mon Sep 17 00:00:00 2001 From: Mark Adamson <3154635+mungojam@users.noreply.github.com> Date: Tue, 23 Jan 2024 16:29:39 +0000 Subject: [PATCH] Return system exit code when running as module --- terraform_compliance/__main__.py | 4 +++- terraform_compliance/main.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/terraform_compliance/__main__.py b/terraform_compliance/__main__.py index f9afe44a..72c578d2 100644 --- a/terraform_compliance/__main__.py +++ b/terraform_compliance/__main__.py @@ -1,3 +1,5 @@ +import sys + from .main import cli -cli() +sys.exit(cli()) diff --git a/terraform_compliance/main.py b/terraform_compliance/main.py index 861e6863..fef47051 100644 --- a/terraform_compliance/main.py +++ b/terraform_compliance/main.py @@ -1,3 +1,4 @@ +import sys import os import shutil import atexit @@ -159,4 +160,4 @@ def cli(arghandling=ArgHandling(), argparser=ArgumentParser(prog=__app_name__, if __name__ == '__main__': - cli() + sys.exit(cli())