diff --git a/slpkg/pkg/find.py b/slpkg/pkg/find.py index 4f23ce6a..5ae918b5 100644 --- a/slpkg/pkg/find.py +++ b/slpkg/pkg/find.py @@ -32,12 +32,16 @@ def find_package(find_pkg, directory): Find packages """ pkgs = [] - if os.path.isdir(directory): - installed = sorted(os.listdir(directory)) - blacklist = BlackList().packages(pkgs=installed, repo="local") - if os.path.exists(directory): - for pkg in installed: - if (not pkg.startswith(".") and pkg.startswith(find_pkg) and - split_package(pkg)[0] not in blacklist): - pkgs.append(pkg) + try: + if os.path.isdir(directory): + installed = sorted(os.listdir(directory)) + blacklist = BlackList().packages(pkgs=installed, repo="local") + if os.path.exists(directory): + for pkg in installed: + if (not pkg.startswith(".") and pkg.startswith(find_pkg) and + split_package(pkg)[0] not in blacklist): + pkgs.append(pkg) + except KeyboardInterrupt: + print("") + raise SystemExit() return pkgs