daemon: small improvements to command error reporting, as well as catching and reporting config service get text dynamic exceptions

This commit is contained in:
Blake Harnden 2022-03-04 09:55:40 -08:00
parent 0536747d9a
commit f545726ed5
3 changed files with 26 additions and 9 deletions

View file

@ -227,6 +227,7 @@ def cmd(
execute is not found
"""
logger.debug("command cwd(%s) wait(%s): %s", cwd, wait, args)
input_args = args
if shell is False:
args = shlex.split(args)
try:
@ -238,13 +239,13 @@ def cmd(
stderr = stderr.decode("utf-8").strip()
status = p.wait()
if status != 0:
raise CoreCommandError(status, args, stdout, stderr)
raise CoreCommandError(status, input_args, stdout, stderr)
return stdout
else:
return ""
except OSError as e:
logger.error("cmd error: %s", e.strerror)
raise CoreCommandError(1, args, "", e.strerror)
raise CoreCommandError(1, input_args, "", e.strerror)
def file_munge(pathname: str, header: str, text: str) -> None: