From 1f06c91fa1e28ae4e491c3d690a769a9b5169469 Mon Sep 17 00:00:00 2001 From: Phillip Berndt Date: Wed, 30 Nov 2016 12:48:20 +0100 Subject: [PATCH] Wrap ifmain code in a function --- autorandr.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/autorandr.py b/autorandr.py index af1c8c3..aa4b8f2 100755 --- a/autorandr.py +++ b/autorandr.py @@ -1040,7 +1040,7 @@ def main(argv): sys.exit(0) -if __name__ == '__main__': +def exception_handled_main(argv=sys.argv): try: main(sys.argv) except AutorandrException as e: @@ -1053,3 +1053,6 @@ if __name__ == '__main__': print("Unhandled exception ({0}). Please report this as a bug at https://github.com/phillipberndt/autorandr/issues.".format(e), file=sys.stderr) raise + +if __name__ == '__main__': + exception_handled_main() -- 2.39.2