def git_cmd(self, args):
git_args = ['git'] + args
try:
res = subprocess.run(
git_args, stdout=subprocess.PIPE,
)
if res.returncode != 0:
err('%s command exited with error: %s',
' '.join(git_args), res.returncode)
return str(res.stdout, 'utf-8').strip()
except FileNotFoundError as e:
err('Cannot find git command: %s', e)
except subprocess.SubprocessError as e:
err('Error running git command: %s', e)
评论列表
文章目录