diff --git a/frappe/commands/__init__.py b/frappe/commands/__init__.py index 832a7eb415..42f4440547 100644 --- a/frappe/commands/__init__.py +++ b/frappe/commands/__init__.py @@ -48,7 +48,7 @@ def get_site(context): site = context.sites[0] return site except (IndexError, TypeError): - sys.exit(1) + raise frappe.SiteNotSpecifiedError def popen(command, *args, **kwargs): output = kwargs.get('output', True) diff --git a/frappe/commands/utils.py b/frappe/commands/utils.py index 869178ff3c..9bed7eb472 100644 --- a/frappe/commands/utils.py +++ b/frappe/commands/utils.py @@ -385,6 +385,8 @@ def mariadb(context): import os site = get_site(context) + if not site: + raise SiteNotSpecifiedError frappe.init(site=site) # This is assuming you're within the bench instance.