Skip to content

Commit 00a5284

Browse files
committed
Display exception name when subprocesses raise them
This change provides more context information for cases like when a command is not found as previous behavior only returned the exist code of the exception, without any other information. Same exit codes could have being produced by commands that did run.
1 parent 343fe92 commit 00a5284

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

docs/changelog/3450.bugfix.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Log exception name when subprocess execution produces one.
2+
3+
- by :user:`ssbarnea`

src/tox/execute/local_sub_process/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ def __enter__(self) -> ExecuteStatus:
214214
env=self.request.env,
215215
)
216216
except OSError as exception:
217+
# We log a nice error message to avout returning opaque error codes,
218+
# like exit code 2 (filenotfound).
219+
logging.error("Exception running subprocess %s", str(exception)) # noqa: TRY400
217220
return LocalSubprocessExecuteFailedStatus(self.options, self._out, self._err, exception.errno)
218221

219222
status = LocalSubprocessExecuteStatus(self.options, self._out, self._err, process)

0 commit comments

Comments
 (0)