diff --git a/test/lib/ansible_test/_internal/git.py b/test/lib/ansible_test/_internal/git.py index b7bb3339e93..31eef59eb5a 100644 --- a/test/lib/ansible_test/_internal/git.py +++ b/test/lib/ansible_test/_internal/git.py @@ -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 diff --git a/test/lib/ansible_test/_internal/util.py b/test/lib/ansible_test/_internal/util.py index fce04ad0af1..e8488498515 100644 --- a/test/lib/ansible_test/_internal/util.py +++ b/test/lib/ansible_test/_internal/util.py @@ -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