2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-17 02:25:16 +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 # imports - standard imports
import json import json
from json.decoder import JSONDecodeError 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="."): 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: try:
import json
apps_sites_dict = json.loads(out) apps_sites_dict = json.loads(out)
except JSONDecodeError: except JSONDecodeError:
return None return None