vcs: collect errors into log

This fixes #39.
This commit is contained in:
lilydjwg 2018-05-29 14:46:53 +08:00
parent e61f9dcd76
commit 116e426d5a

View File

@ -1,5 +1,5 @@
# MIT licensed
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
# Copyright (c) 2013-2018 lilydjwg <lilydjwg@gmail.com>, et al.
import asyncio
import os.path as _path
@ -34,12 +34,19 @@ async def get_version(name, conf, **kwargs):
cmd = _cmd_prefix + [name, vcs]
if use_max_tag:
cmd += ["get_tags"]
p = await asyncio.create_subprocess_exec(*cmd, stdout=asyncio.subprocess.PIPE)
p = await asyncio.create_subprocess_exec(
*cmd,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
)
output, error = await p.communicate()
output = output.strip().decode('latin1')
error = error.strip().decode('latin1')
output = (await p.communicate())[0].strip().decode('latin1')
if p.returncode != 0:
logger.error('command exited with error',
name=name, returncode=p.returncode)
logger.error('command exited with error', output=output,
name=name, returncode=p.returncode, error=error)
return
else:
if use_max_tag: