Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return full error message from xmllint #586

Merged
merged 4 commits into from
Oct 3, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion scripts/parse_tools/xml_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ def call_command(commands, logger, silent=False):
False
>>> call_command(['ls'], _LOGGER)
True
>>> try:
... call_command(['ls','--invalid-option'], _LOGGER)
... except CCPPError as e:
... print(str(e))
Execution of 'ls --invalid-option' failed with code:
climbfuji marked this conversation as resolved.
Show resolved Hide resolved
Error output: ls: unrecognized option '--invalid-option'
Try 'ls --help' for more information.
gold2718 marked this conversation as resolved.
Show resolved Hide resolved
"""
result = False
outstr = ''
Expand All @@ -68,7 +75,13 @@ def call_command(commands, logger, silent=False):
cmd = ' '.join(commands)
emsg = "Execution of '{}' failed with code:\n"
outstr = emsg.format(cmd, err.returncode)
climbfuji marked this conversation as resolved.
Show resolved Hide resolved
outstr += "{}".format(err.output)
outstr += f"{err.output.decode('utf-8', errors='replace').strip()}"
if hasattr(err, 'stderr') and err.stderr:
stderr_str = err.stderr.decode('utf-8', errors='replace').strip()
if stderr_str:
outstr += f"Error output: {stderr_str}"
gold2718 marked this conversation as resolved.
Show resolved Hide resolved
# end if
# end if
raise CCPPError(outstr) from err
# end if
# end of try
Expand Down
Loading