ansible-test - Continue if the git command returns an error (#61605)
* ansible-test - Contiune if the git command returns an error * Just return stdout * Use to_text() when displaying exception * Add a message property to SubprocessError
This commit is contained in:
parent
1d40d2b572
commit
e218c9814c
2 changed files with 8 additions and 1 deletions
|
@ -8,7 +8,9 @@ from . import types as t
|
|||
|
||||
from .util import (
|
||||
SubprocessError,
|
||||
display,
|
||||
raw_command,
|
||||
to_text,
|
||||
)
|
||||
|
||||
|
||||
|
@ -124,4 +126,8 @@ class Git:
|
|||
:type str_errors: str
|
||||
:rtype: str
|
||||
"""
|
||||
return raw_command([self.git] + cmd, cwd=self.root, capture=True, str_errors=str_errors)[0]
|
||||
try:
|
||||
return raw_command([self.git] + cmd, cwd=self.root, capture=True, str_errors=str_errors)[0]
|
||||
except SubprocessError as spe:
|
||||
display.warning(to_text(spe.message))
|
||||
return spe.stdout
|
||||
|
|
|
@ -754,6 +754,7 @@ class SubprocessError(ApplicationError):
|
|||
super(SubprocessError, self).__init__(message)
|
||||
|
||||
self.cmd = cmd
|
||||
self.message = message
|
||||
self.status = status
|
||||
self.stdout = stdout
|
||||
self.stderr = stderr
|
||||
|
|
Loading…
Reference in a new issue