[cli] Clean cli calls to account for empty strings

pull/2/head
Daniel Van Der Maden 5 years ago
parent b8ceb839b3
commit 793e006826
  1. 2
      pyhmy/_version.py
  2. 4
      pyhmy/cli.py

@ -7,5 +7,5 @@ Provides pyhmy version information.
from incremental import Version from incremental import Version
__version__ = Version('pyhmy', 20, 1, 24) __version__ = Version('pyhmy', 20, 1, 25)
__all__ = ["__version__"] __all__ = ["__version__"]

@ -275,7 +275,7 @@ def single_call(command, timeout=60, error_ok=False):
:returns: Decoded string of response from hmy CLI call :returns: Decoded string of response from hmy CLI call
:raises: RuntimeError if bad command :raises: RuntimeError if bad command
""" """
command_toks = command.split(" ") command_toks = [el for el in command.split(" ") if el]
if re.match(".*hmy", command_toks[0]): if re.match(".*hmy", command_toks[0]):
command_toks = command_toks[1:] command_toks = command_toks[1:]
command_toks = [_binary_path] + command_toks command_toks = [_binary_path] + command_toks
@ -295,7 +295,7 @@ def expect_call(command, timeout=60):
:returns: A pexpect child program :returns: A pexpect child program
:raises: RuntimeError if bad command :raises: RuntimeError if bad command
""" """
command_toks = command.split(" ") command_toks = [el for el in command.split(" ") if el]
if re.match(".*hmy", command_toks[0]): if re.match(".*hmy", command_toks[0]):
command_toks = command_toks[1:] command_toks = command_toks[1:]
try: try:

Loading…
Cancel
Save