Skip to content

Commit 0a9d363

Browse files
committed
Fix capture mypy stderr output on fatal options error instead of generic message
1 parent c2838ef commit 0a9d363

2 files changed

Lines changed: 2 additions & 20 deletions

File tree

prospector/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def execute(self) -> None:
113113
loc = Location(self.config.workdir, None, None, None, None)
114114
msg = (
115115
f"Tool {toolname} failed to run "
116-
f"(exception was raised, re-run prospector with -X to see the stacktrace)"
116+
f"(exception was raised, re-run prospector with --direct-tool-stdout to better see the error or --die-on-tool-error to see the stacktrace)"
117117
)
118118
message = Message(
119119
toolname,

prospector/tools/mypy/__init__.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -126,25 +126,7 @@ def run(self, found_files: FileFinder) -> list[Message]:
126126

127127
def _run_std(self, args: list[str]) -> list[Message]:
128128
messages = []
129-
try:
130-
sources, options = mypy.main.process_options(args, fscache=self.fscache)
131-
except (SystemExit, Exception) as e:
132-
message = "The error(s) will be displayed before the messages" if isinstance(e, SystemExit) else str(e)
133-
messages.append(
134-
Message(
135-
"mypy",
136-
code="fatal-options-error",
137-
message=message,
138-
location=Location(
139-
path="",
140-
module=None,
141-
function=None,
142-
line=0,
143-
character=0,
144-
),
145-
)
146-
)
147-
return messages
129+
sources, options = mypy.main.process_options(args, fscache=self.fscache)
148130
options.output = "json"
149131
try:
150132
res = mypy.build.build(sources, options, fscache=self.fscache)

0 commit comments

Comments
 (0)