osbuild: always return exit code

osbuild_cli() sometimes returned an exit code, but at the end called
sys.exit() directly. The idea was probably to always return the code
with which the executable should exit.

Make this consistent and call sys.exit() in __main__.py, with the value
returned by osbuild_cli().
This commit is contained in:
Lars Karlitski 2020-10-27 10:18:14 +01:00 committed by Christian Kellner
parent 4c34b2c501
commit a5d4a8a926
2 changed files with 4 additions and 2 deletions

View file

@ -4,9 +4,11 @@ This specifies the entrypoint of the osbuild module when run as executable. For
compatibility we will continue to run the CLI.
"""
import sys
from osbuild.main_cli import osbuild_cli as main
if __name__ == "__main__":
main()
r = main()
sys.exit(r)

View file

@ -172,4 +172,4 @@ def osbuild_cli():
print()
print(f"{RESET}{BOLD}{RED}Failed{RESET}")
sys.exit(0 if r["success"] else 1)
return 0 if r["success"] else 1