Browse Source

Use `sys.exit()` calls

Signed-off-by: shubhendra <withshubh@gmail.com>
shubhendra 3 years ago
parent
commit
bf7684096e
2 changed files with 4 additions and 3 deletions
  1. 1 1
      utils/downloads.py
  2. 3 2
      utils/prune_binaries.py

+ 1 - 1
utils/downloads.py

@@ -365,7 +365,7 @@ def _retrieve_callback(args):
         check_downloads(DownloadInfo(args.ini), args.cache)
     except HashMismatchError as exc:
         get_logger().error('File checksum does not match: %s', exc)
-        exit(1)
+        sys.exit(1)
 
 
 def _unpack_callback(args):

+ 3 - 2
utils/prune_binaries.py

@@ -10,6 +10,7 @@ import argparse
 from pathlib import Path
 
 from _common import ENCODING, get_logger, add_common_params
+import sys
 
 
 def prune_dir(unpack_root, prune_files):
@@ -32,7 +33,7 @@ def prune_dir(unpack_root, prune_files):
 def _callback(args):
     if not args.directory.exists():
         get_logger().error('Specified directory does not exist: %s', args.directory)
-        exit(1)
+        sys.exit(1)
     if not args.pruning_list.exists():
         get_logger().error('Could not find the pruning list: %s', args.pruning_list)
     prune_files = tuple(filter(len, args.pruning_list.read_text(encoding=ENCODING).splitlines()))
@@ -41,7 +42,7 @@ def _callback(args):
         get_logger().error('%d files could not be pruned.', len(unremovable_files))
         get_logger().debug('Files could not be pruned:\n%s',
                            '\n'.join(f for f in unremovable_files))
-        exit(1)
+        sys.exit(1)
 
 
 def main():