updates to force CoreCommandError to contain string values for stderr and stdout, couple bugfixes in handling bad commands when using execute commands from tlv based api or coresendmsg, also updates to coresendmsg to display everything in lowercase to mimic previous look and feel, however coresendmg will now work regardless of casing to avoid breaking things again
This commit is contained in:
parent
454dc8091e
commit
95d3a6ca8c
7 changed files with 29 additions and 36 deletions
|
@ -231,14 +231,17 @@ def cmd(
|
|||
p = Popen(args, stdout=PIPE, stderr=PIPE, env=env, cwd=cwd, shell=shell)
|
||||
if wait:
|
||||
stdout, stderr = p.communicate()
|
||||
stdout = stdout.decode("utf-8").strip()
|
||||
stderr = stderr.decode("utf-8").strip()
|
||||
status = p.wait()
|
||||
if status != 0:
|
||||
raise CoreCommandError(status, args, stdout, stderr)
|
||||
return stdout.decode("utf-8").strip()
|
||||
return stdout
|
||||
else:
|
||||
return ""
|
||||
except OSError:
|
||||
raise CoreCommandError(-1, args)
|
||||
except OSError as e:
|
||||
logging.error("cmd error: %s", e.strerror)
|
||||
raise CoreCommandError(1, args, "", e.strerror)
|
||||
|
||||
|
||||
def file_munge(pathname: str, header: str, text: str) -> None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue