mirror of
https://github.com/frappe/bench.git
synced 2024-11-12 00:06:36 +00:00
fix: check for updates after command execution and handle
requests Exceptions
This commit is contained in:
parent
62f666c481
commit
6ea7d75193
@ -1,3 +1,4 @@
|
||||
import atexit
|
||||
import click
|
||||
import os, sys, logging, json, pwd, subprocess
|
||||
from bench.utils import is_root, PatchError, drop_privileges, get_env_cmd, get_cmd_output, get_frappe, log, is_dist_editable, find_parent_bench, check_latest_version
|
||||
@ -41,8 +42,7 @@ def cli():
|
||||
|
||||
else:
|
||||
try:
|
||||
# NOTE: this is the main bench command
|
||||
check_latest_version()
|
||||
atexit.register(check_latest_version)
|
||||
bench_command()
|
||||
except PatchError:
|
||||
sys.exit(1)
|
||||
|
@ -82,7 +82,12 @@ def safe_decode(string, encoding = 'utf-8'):
|
||||
|
||||
|
||||
def check_latest_version():
|
||||
pypi_request = requests.get("https://pypi.org/pypi/frappe-bench/json")
|
||||
try:
|
||||
pypi_request = requests.get("https://pypi.org/pypi/frappe-bench/json")
|
||||
except Exception:
|
||||
# Exceptions thrown are defined in requests.exceptions
|
||||
# ignore checking on all Exceptions
|
||||
return
|
||||
|
||||
if pypi_request.status_code == 200:
|
||||
pypi_version_str = pypi_request.json().get('info').get('version')
|
||||
|
Loading…
Reference in New Issue
Block a user