[cli] Add check for path in `set_binary`

pull/2/head
Daniel Van Der Maden 5 years ago
parent b7c5354949
commit c636750e35
  1. 7
      pyhmy/cli.py

@ -173,6 +173,7 @@ def set_binary(path):
"""
global _binary_path
path = os.path.realpath(path)
assert os.path.exists(path)
os.chmod(path, os.stat(path).st_mode | stat.S_IEXEC)
if not is_valid_binary(path):
return False
@ -307,6 +308,6 @@ def expect_call(command, timeout=60):
if os.path.exists(f"{get_gopath()}/src/github.com/harmony-one/bls") \
and os.path.exists(f"{get_gopath()}/src/github.com/harmony-one/mcl"): # Check prevents needless import fails.
_environment.update(get_bls_build_variables()) # Needed if using dynamically linked CLI binary.
default_bin_path = _get_default_hmy_binary_path()
if default_bin_path: # Check prevents needless import fails.
set_binary(default_bin_path)
_default_bin_path = _get_default_hmy_binary_path()
if _default_bin_path: # Check prevents needless import fails.
set_binary(_default_bin_path)

Loading…
Cancel
Save