diff --git a/pywal/__main__.py b/pywal/__main__.py index 98cafe4..de302d6 100644 --- a/pywal/__main__.py +++ b/pywal/__main__.py @@ -73,16 +73,16 @@ def process_args(args): if not len(sys.argv) > 1: print("error: wal needs to be given arguments to run.\n" " Refer to \"wal -h\" for more info.") - exit(1) + sys.exit(1) if args.i and args.f: print("error: Conflicting arguments -i and -f.\n" " Refer to \"wal -h\" for more info.") - exit(1) + sys.exit(1) if args.v: print(f"wal {__version__}") - exit(0) + sys.exit(0) if args.q: sys.stdout = sys.stderr = open(os.devnull, "w") @@ -125,10 +125,6 @@ def main(): args = get_args(sys.argv[1:]) process_args(args) - # This saves 10ms. - # pylint: disable=W0212 - # os._exit(0) - if __name__ == "__main__": main() diff --git a/pywal/colors.py b/pywal/colors.py index 7e2dbb0..1668a13 100644 --- a/pywal/colors.py +++ b/pywal/colors.py @@ -4,6 +4,7 @@ Generate a colorscheme using imagemagick. import re import shutil import subprocess +import sys from .settings import CACHE_DIR, COLOR_COUNT from . import util @@ -25,7 +26,7 @@ def gen_colors(img, color_count): if not shutil.which("convert"): print("error: imagemagick not found, exiting...\n" "error: wal requires imagemagick to function.") - exit(1) + sys.exit(1) raw_colors = imagemagick(color_count, img) @@ -41,7 +42,7 @@ def gen_colors(img, color_count): if index > 20: print("colors: Imagemagick couldn't generate a suitable scheme", "for the image. Exiting...") - quit(1) + sys.exit(1) # Remove the first element because it isn't a color code. del raw_colors[0] diff --git a/pywal/image.py b/pywal/image.py index 0e6774b..787bb80 100644 --- a/pywal/image.py +++ b/pywal/image.py @@ -4,6 +4,7 @@ Get the image file. import os import pathlib import random +import sys from .settings import CACHE_DIR from . import util @@ -21,7 +22,7 @@ def get_random_image(img_dir): if not images: print("image: No new images found (nothing to do), exiting...") - quit(1) + sys.exit(1) return str(img_dir / random.choice(images).name) @@ -38,7 +39,7 @@ def get(img, cache_dir=CACHE_DIR): else: print("error: No valid image file found.") - exit(1) + sys.exit(1) # Cache the image file path. util.save_file(wal_img, cache_dir / "wal") diff --git a/pywal/reload.py b/pywal/reload.py index 0b2fbcf..3e7a6c3 100644 --- a/pywal/reload.py +++ b/pywal/reload.py @@ -4,6 +4,7 @@ Reload programs. import re import shutil import subprocess +import sys from .settings import CACHE_DIR, HOME, MODULE_DIR from . import util @@ -71,4 +72,4 @@ def colors(vte, cache_dir=CACHE_DIR): print(sequences, end="") - exit(0) + sys.exit(0)