2
0
mirror of https://github.com/frappe/bench.git synced 2024-06-27 11:43:29 +00:00

fix: Handle command execution failures

This commit is contained in:
Gavin D'souza 2021-05-10 19:10:06 +05:30
parent 0c21718f7a
commit dcdb15d471

View File

@ -1,6 +1,3 @@
# imports - compatibility imports
from __future__ import print_function
# imports - standard imports
import json
from json.decoder import JSONDecodeError
@ -237,10 +234,16 @@ def validate_app_installed_on_sites(app, bench_path="."):
def check_app_installed(app, bench_path="."):
out = subprocess.check_output(["bench", "--site", "all", "list-apps", "--format", "json"], cwd=bench_path).decode('utf-8')
try:
out = subprocess.check_output(
["bench", "--site", "all", "list-apps", "--format", "json"],
stderr=open(os.devnull, "wb"),
cwd=bench_path,
).decode('utf-8')
except subprocess.CalledProcessError:
return None
try:
import json
apps_sites_dict = json.loads(out)
except JSONDecodeError:
return None