summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2017-07-28 17:49:40 +1000
committerDylan Araps <dylan.araps@gmail.com>2017-07-28 17:49:40 +1000
commitb60d9d0d9758982d48272fa5c59fcb4b7e54d8aa (patch)
treed2480caee0754fef7ca8070e631a34a47ed9d43d
parentd67cd885ea88c3d11bb2d671c231aa9364f6ba14 (diff)
general: Use sys.exit everywhere.
-rw-r--r--pywal/__main__.py10
-rw-r--r--pywal/colors.py5
-rw-r--r--pywal/image.py5
-rw-r--r--pywal/reload.py3
4 files changed, 11 insertions, 12 deletions
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)