From d51a42589c064da6829de01a66c2923a0a92403e Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Fri, 28 Aug 2020 18:53:55 +0300 Subject: [PATCH] Use sys.exit() instead of exit(): exit() cuases stack trace output from pyinstaller exe. It is also recommended to use sys.exit() in prodcution. Signed-off-by: HeshamTB --- rsa.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/rsa.py b/rsa.py index 6169680..39d75e7 100644 --- a/rsa.py +++ b/rsa.py @@ -40,11 +40,11 @@ def main(): saveKeyFile(key, keyFileName) except IOError: print("could not write file") - exit(1) + sys.exit(1) except Exception as ex: print(ex) - exit(1) - exit(0) + sys.exit(1) + sys.exit(0) if sys.argv[1] == "encrypt": ##rsa encrypt if len(sys.argv) == 5: msg = sys.argv[2] @@ -64,7 +64,7 @@ def main(): print("Not enough arguments") print("rsa encrypt ") #Make help function - exit(0) + sys.exit(0) if sys.argv[1] == "decrypt": ##rsa decrypt "" if len(sys.argv) == 4: cipher = sys.argv[2] @@ -83,16 +83,16 @@ def main(): else: print("Not enough arguments") print("rsa decrypt \"\" ") - exit(0) + sys.exit(0) if sys.argv[1] == "list": listKeys() - exit(0) + sys.exit(0) if sys.argv[1] == "export": #rsa export if len(sys.argv) == 3: key_file_name = sys.argv[2] exportKey(key_file_name) - exit(0) + sys.exit(0) else: print("Not enough arguments") print("rsa export ") @@ -107,7 +107,7 @@ def main(): #No command exit code printHelp() - exit(127) + sys.exit(127)