Skip to content

Commit d7d17c0

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 d7d17c0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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)