def format_error(self, script, res) -> str:
template = '''
{cmd}
Script:
{script}
Output:
{stderr}
'''
def indent(text, prefix='> '):
return textwrap.indent(text.strip(), prefix, lambda line: True)
template = textwrap.dedent(template).rstrip()
return template.format(
cmd=indent(' '.join(res.args)),
script=indent(script),
stderr=indent(res.stderr.decode('utf8')),
)
评论列表
文章目录