提交 3df60605 编写于 作者: B Brian Johnson

Added exception handling around testUtils.checkOutput. GH #5199

上级 94d08370
......@@ -1064,8 +1064,10 @@ class Cluster(object):
if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
psOut=Utils.checkOutput(cmd.split())
return psOut
except subprocess.CalledProcessError as _:
pass
except subprocess.CalledProcessError as ex:
msg=ex.output.decode("utf-8")
Utils.Print("ERROR: call of \"%s\" failed. %s" % (cmd, msg))
return None
return None
psOut=Utils.waitForObj(myFunc, timeout)
......
......@@ -55,7 +55,17 @@ class WalletMgr(object):
p = re.compile(r'\n\"(\w+)\"\n', re.MULTILINE)
cmd="%s %s wallet create --name %s --to-console" % (Utils.EosClientPath, self.endpointArgs, name)
if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
retStr=Utils.checkOutput(cmd.split())
retStr=None
try:
retStr=Utils.checkOutput(cmd.split())
except subprocess.CalledProcessError as ex:
msg=ex.output.decode("utf-8")
msg="ERROR: Failed to import account owner key %s. %s" % (account.ownerPrivateKey, msg)
if exitOnError:
Utils.errorExit("%s" % (msg))
Utils.Print("%s" % (msg))
return None
#Utils.Print("create: %s" % (retStr))
m=p.search(retStr)
if m is None:
......@@ -152,8 +162,14 @@ class WalletMgr(object):
p = re.compile(r'\s+\"(\w+)\s\*\",?\n', re.MULTILINE)
cmd="%s %s wallet list" % (Utils.EosClientPath, self.endpointArgs)
if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
retStr=Utils.checkOutput(cmd.split())
#Utils.Print("retStr: %s" % (retStr))
retStr=None
try:
retStr=Utils.checkOutput(cmd.split())
except subprocess.CalledProcessError as ex:
msg=ex.output.decode("utf-8")
Utils.Print("ERROR: Failed to open wallets. %s" % (msg))
return False
m=p.findall(retStr)
if m is None:
Utils.Print("ERROR: wallet list parser failure")
......@@ -168,8 +184,13 @@ class WalletMgr(object):
p = re.compile(r'\n\s+\"(\w+)\"\n', re.MULTILINE)
cmd="%s %s wallet private_keys --name %s --password %s " % (Utils.EosClientPath, self.endpointArgs, wallet.name, wallet.password)
if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
retStr=Utils.checkOutput(cmd.split())
#Utils.Print("retStr: %s" % (retStr))
retStr=None
try:
retStr=Utils.checkOutput(cmd.split())
except subprocess.CalledProcessError as ex:
msg=ex.output.decode("utf-8")
Utils.Print("ERROR: Failed to get keys. %s" % (msg))
return False
m=p.findall(retStr)
if m is None:
Utils.Print("ERROR: wallet private_keys parser failure")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册